I'm writing a Web service, using Jersey 2.17 with Tomcat 8.
In the web.xml when I change my url pattern to /* I'm able to hit the web-service and get response. However when I change the url pattern to / then I always get 404 Error (resource not found).
Doesn't work
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Work's Perfectly
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
My web.xml contains no other Servlet or Filter mappings apart from this.
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>
org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.bandi.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Is there any other configuration needed to make this work? I cannot afford to use /* as the servlet mapping because I need certain Filters to run before this servlet gets executed. If the filter fails then the call to servlet should not go ahead.
So basically I don't want to override any mappings that are already present.