JSF web.xml URI Mappings
I've come across something which I need someone to explain. It's not something that I would advocate doing but the behaviour interests me. I have 2 servlet mappings for the FacesServlet in the web.xml.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
If I use the uri <web-context>/jsf/index.faces using Tomcat 6.0.10 the request never returns the index.jsp page.
If I remove one either one of the servlet mappings, the uri <web-context>/jsf/index.faces returns the index.jsp page correctly.
It seems that having 2 mappings that are both applicable to the uri <web-context>/jsf/index.faces causes an issue.
Just wonder if anyone is able to explain this behaviour. It is a problem with JSF or Servlet/JSPs in general. I would have thought that some precedence ordering would have been applicable and the request would be fulfilled even when both servlet mappings are present.
Thanks
[1236 byte] By [
slenno02a] at [2007-11-27 4:32:00]

# 2
Hi,
Thanks for the reply. I tested it using a simple servlet and mapping and it works fine. Therefore I think the issue may lie with the JSF RI. I'm using Glassfish 1.2_04 api and implementation. In fact if I use the following mapping the request it never fulfilled.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
Does anyone have this problem or know why it occurs.
Thanks
# 8
Thanks for this. Looking at this I can see why. However one things that still has me puzzled is the following.
I have 2 servlet mappings (this is for experimental purposes only)
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
When I submit the url http://localhost:8080/jsf/faces/index.faces the application totally flips out and the request is never serviced. There is an infinite wait. This is because there are 2 mappings which relate to this request. Remove one of the mappings and the application works fine.
I tried a similar mapping using plain servlets ie;
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/test/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
I submitted the url http://localhost:8080/example/test/index.jsp and it works fine. There is something different occurring in JSF. Does anyone know what is could be?
Thanks