users@jersey.java.net

Re: [Jersey] Explicit registration of Jersey servlet ?

From: Arun Gupta <Arun.Gupta_at_Sun.COM>
Date: Thu, 18 Feb 2010 07:10:05 -0800

>> This is deployed as simplewebapp.war on GlassFish v3.
>>
>> http://localhost:8080/simplewebapp/actor/4
>>
>
> I am not sure what a "simplewebapp.war" is, but i think i can guess it
> is one that has no web.xml?
Yep, just the resource class and no web.xml.

>
> Assuming that is the case you need to include the following:
>
> @ApplicationPath("/sakila")
> public class MyApplication extends Application {
> }
>
>
> An implementation of Application is required for inform Jersey what root
> resource and provider classes are registered. If you do not override any
> of the methods then all classes annotationed with @Path and @Provider
> will be included.
JSF registers FacesServlet by scanning through all the classes and
looking for @ManagedBean or any of the JSF annotations and then
automatically registered. I was wondering if Jersey could register the
servlet that way as well instead of providing an extra marker class.

-Arun

>
> Paul.
>
>
>> gives a 404. However adding:
>>
>> <servlet>
>> <servlet-name>Jersey Web Application</servlet-name>
>> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
>>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>Jersey Web Application</servlet-name>
>> <url-pattern>/sakila/*</url-pattern>
>> </servlet-mapping>
>>
>> to web.xml, then the resource is available at:
>>
>> http://localhost:8080/simplewebapp/sakila/actor/4.
>>
>> Why Jersey servlet need to be registered explicitly ?
>>
>> -Arun
>> --
>> Need Application Server ? Download from http://glassfish.org
>> Blog: http://blogs.sun.com/arungupta
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
Need Application Server ? Download from http://glassfish.org
Blog: http://blogs.sun.com/arungupta