users@glassfish.java.net

Re: JAX-RS and CDI integration using Glassfish v3

From: Alexis Moussine-Pouchkine <alexis.mp_at_sun.com>
Date: Thu, 21 Jan 2010 11:27:37 +0100

On 20 janv. 2010, at 23:01, glassfish_at_javadesktop.org wrote:

> In order to deploy a JAX-RS endpoint (ie: @javax.ws.rs.Path), I seem to have to configure the Jersey servlet in web.xml (com.sun.jersey.spi.container.servlet.ServletContainer, and parameter, com.sun.jersey.config.property.packages). This works well, but is there a more portable JEE6 way?

JAX-RS 1.1 offers a @ApplicationPath annotation applicable to javax.ws.rs.core.Application which let you specify the webcontext and remove the need for any web.xml


> Another annoying side-effect of having to do this is that the Jersey servlet bootstrapper does not perform CDI injections on the endpoint.
>
> However, if I mark the endpoint with @javax.annotation.ManagedBean, then CDI injections work fine. However, shouldn't @javax.ws.rs.Path be enough to enable CDI injections? Am I missing something in the JEE6 spec?

I'll let Paul answer this one.

-Alexis


>
> Thanks.
> [Message sent by forum member 'jeremynorris' (jnorris_at_pattern73.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=382037
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>