users@jersey.java.net

Variation in configuration of Jersey Servlet

From: Suchitha Koneru (sukoneru) <"Suchitha>
Date: Mon, 23 Nov 2009 18:22:46 -0800

Hello Jersey Users ,

        I have observed that Jersey servlet needs to be configured
differently in the web.xml based on the container. Is this variation
due to the restrictions imposed by the container ?

 

For example in case of Jboss, I have noticed that if we do not pass
any resource packages as <init param> to the Jersey servlet , all
the restful resources present in the class path are automatically
identified. Is this the expected behavior ?

 

Following is the web.xml configuration based on the container

 

<servlet >

<servlet-name>Jersey Web Application</servlet-name >

<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</se
rvlet-class>


<!-- resource package configuration for embedded JETTY server -->

<init-param>

<param-name>com.sun.jersey.config.property.packages</param-name>

<param-value>com.cisco.ca.csp.service.hello;com.cisco.ca.ast.service.use
rmgmt.resource;com.cisco.ca.ast.service.pollingsvcs;com.cisco.ca.ast.ser
vice.reports</param-value >

</init-param>


<!-- resource package configuration for JBOSS -->

<!-- either use this or do not pass any init params for resource
configuration. In both the scenarios all the resources classes present
in the class path are fetched

<init-param>

 
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-na
me>

 
<param-value>com.sun.jersey.api.core.ClasspathResourceConfig</param-valu
e>

 </init-param>

<init-param>

 

-->


 

 

Thank you,

Suchitha