vendredi 27 février 2015

Spring servlet mapping works only with /*

I'm trying to configure a spring DispatcherServlet for the path /statefull/wallet/user/login. In my web.xml file, I tried the following :



<servlet>
<servlet-name>spring-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
...
</servlet>
<servlet-mapping>
<servlet-name>spring-servlet</servlet-name>
<url-pattern>/statefull/*</url-pattern>
</servlet-mapping>


But this is not working. The only configuration that worked for me is:



<servlet>
<servlet-name>spring-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
...
</servlet>
<servlet-mapping>
<servlet-name>spring-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>


I can't keep this second configuration, because I want to have some other servlet mappings, whereas the second configuration will map all the requests to the same servlet.


Any idea, what is the mistake in the first configuration ?


Aucun commentaire:

Enregistrer un commentaire