Comment passer les deux paramètres de la requête dans l'URL

@Stateless
@Path("projection")
public class ProjectionManager {

@Inject
private ProjectionDAO projectionDAO;

@Inject
private UserContext userContext;

@GET
@Path("{projectionId}")
@Produces("application/json")
public String places(@PathParam("projectionId") String projectionId) {
    return projectionDAO.findById(Long.parseLong(projectionId)).getPlaces().toString();
}}

Dans cet exemple, l'url de ce service devrait être /projection/projectionId, mais comment je peux avoir accès à un service de deux ou plusieurs requêtes parametar dans ce code :

@PUT
@Path("/buy")
public Response buyTicket(@QueryParam("projectionId") String projectionId, @QueryParam("place") String place){
    Projection projection = projectionDAO.findById(Long.parseLong(projectionId));
    if(projection != null){
        projectionDAO.buyTicket(projection, userContext.getCurrentUser(), Integer.parseInt(place));
    }

    return Response.noContent().build();
}
Vous venez d'invoquer HTTP METTRE à /buy?projectionId=1.

OriginalL'auteur alle3x | 2015-06-17