When injecting HttpServletRequest
in Jersey/JAX-RS resources, the injected value is a proxy. E.g.:
@Path("/myResource") class MyResource { @Inject HttpServletRequest request; ... }
Will inject a Proxy
object for the requested HttpServletRequest
. I need access to the actual HttpServletRequest
instance object, because I want to use some container specific features that are not in the proxied HttpServletRequest
interface.
Is there a way in jersey to have access to the actual object via injection? I know that in older versions of Jersey you could inject a ThreadLocal<HttpServletRequest>
to achieve this. But that doesn't seem to be supported in jersey 2.15 anymore.
Rationale: My code depends on functionality in org.eclipse.jetty.server.Request
which implements HttpRequest
, and adds functionality for HTTP/2 push. I would like to use that with Jersey/JAX-RS.
Read full article from java - Is it possible in Jersey to have access to an injected HttpServletRequest, instead of to a proxy - Stack Overflow
No comments:
Post a Comment