If you want to get information from the original request object, you can add the following to the controller.
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;
@Path("/my")
@Produces(["application/json", "application/hal+json"])
class MyController {
@Context
protected HttpServletRequest httpRequest
@Timed
@GET
public Response getOne(){
httpRequest.getHeaders();
...
return Response.ok(new Person(id:1), httpRequest.getContentType());
}
source
share