Configuring web.xml for the servlet 2.x container

If the JAX-RS application does not have an Application subclass in the project, then you need to specify a fully qualified servlet class that is used by the JAX-RS runtime and a servlet-mapping entry in web.xml. You can also specify the package where the runtime should scan though to find the JAX-RS components, such as class resources, filters, interceptors, and so on.

The following example shows the configuration entries that you may need to make in web.xml to deploy a JAX-RS application without the Application subclass on the servlet 2.0 based container:

<web-app> 
    <servlet>  
        <servlet-name>jaxrs.servlet</servlet-name> 
        <servlet-class> 
         org.glassfish.jersey.servlet.ServletContainer 
        </servlet-class> 
        <!-- Register resources and providers 
         under com.packtpub.rest --> 
        <init-param> 
            <param-name> 
             jersey.config.server.provider.packages</param-name> 
            <param-value>com.packtpub.rest</param-value> 
        </init-param> 
 
        <!- 
         Register custom providers  
        (not needed if they are in com.packtpub.rest)  --> 
        <init-param> 
            <param-name> 
             jersey.config.server.provider.classnames</param-name> 
            <param-value>  
             com.packtpub.rest.filetr.SecurityRequestFilter; 
             com.packtpub.rest.filetr.Logger 
           </param-value> 
        </init-param>    
    </servlet> 
    <servlet-mapping> 
        <servlet-name>jaxrs.servlet</servlet-name> 
        <url-pattern>/webresources/*</url-pattern> 
    </servlet-mapping> 
 
</web-app> 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.255.168