Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Request object from REST

Is it possible to access the Request object in a REST method under JAX-RS?

I just found out

@Context Request request; 
like image 619
qnoid Avatar asked Jun 25 '09 11:06

qnoid


1 Answers

On JAX-RS you must annotate a Request parameter with @Context:

 @GET    public Response foo(@Context Request request) {   } 

Optionally you can also inject:

  • UriInfo
  • HttpHeaders
  • SecurityContext
  • HttpServletRequest
like image 64
dfa Avatar answered Sep 23 '22 10:09

dfa