In this example, the URL for a service has the form /projection/projectionId:
@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();
}}
How can I pass two (or more) query parameters to access the service using this 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();
}
/buy?projectionId=1.