users@jersey.java.net

[Jersey] Re: Injection (_at_Context) of a Request/Response object in conjunction with jersey-simple-server module

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 08 Feb 2012 17:41:08 +0100

Hello Philipp,

it is possible but you would need to register them by yourself by some
container specific code, see for example jersey-servlet module,
WebComponent.configure(WebConfig wc, ResourceConfig rc, WebApplication
wa). First few calls are singleton registrations.

Hope it helps,
Pavel

On 2/2/12 4:12 PM, justphilmusic_at_googlemail.com wrote:
> Hello everybody!
>
> I'm about to run some tests with Jersey running on top of Simple HTTP
> Web server. Having already developed a good dozen of Jersey based web
> services running on top of Grizzly/Glassfish I know that you can inject
> ServletConfig, ServletContext, HttpServletRequest and
> HttpServletResponse by using the @Context annotation.
>
> However, Simple HTTP Web server is not a servlet based container.
> Rather, it uses proprietary Request/Response objects:
>
> org.simpleframework.http.Response
> org.simpleframework.http.Request
>
>
> So, the question is:
> Is there a possibility to inject these proprietary objects into Jersey
> resources?
>
> Something like the code below doesn't work.
>
> @GET
> @Produces(MediaType.APPLICATION_JSON)
> public Response getUser( @Context org.simpleframework.http.Request
> simpleRequest ) {
>
> }
>
>
> Thank you in advance!
>
> Philipp
>