-
1. Re: welcome-file-list in web.xml is ignored ?
jaikiran May 27, 2013 8:40 AM (in response to rhanus)What exactly does the web.xml contents look like? We had fixed this issue in 8.0.0.Alpha1 and in upstream/master.
-
2. Re: welcome-file-list in web.xml is ignored ?
rhanus May 27, 2013 8:42 AM (in response to jaikiran)Hi Jaikiran,
web.xml is following:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Sample RichFaces 4 Application</display-name>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<!-- Resource Servlet - serves static resources and resources for specific components -->
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
<!-- Resource Mapping - resources will be served compressed and packed in production -->
<context-param>
<param-name>org.richfaces.resourceMapping.enabled</param-name>
<param-value>true</param-value>
</context-param>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
-
3. Re: welcome-file-list in web.xml is ignored ?
jaikiran May 27, 2013 8:46 AM (in response to rhanus)<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
...
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
This is a different case than the one we had fixed. I'll check with Stuart if he knows about this one.
-
4. Re: welcome-file-list in web.xml is ignored ?
sfcoy May 27, 2013 8:19 PM (in response to rhanus)Radim Hanus wrote:
...
web.xml is following:
...
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
...
This is not how welcome files work.
A welcome file is the name of a resource that should be returned by the server when the requested URL consists of only a directory path.
For example, if you have the following welcome file:
{code:xml}<welcome-file>index.xhtml</welcome-file>{code}
and the user requests the URL "http://yourhost/your-app-context/" (note the trailing "/"), then the container will look for an index.xhtml in the root of your application and use it to generate the response.
The thing is, the welcome file list applies to all directory paths, so if the user requests "http://yourhost/your-app-context/faces/", then the container will return the result that you were originally expecting. ie. "http://yourhost/your-app-context/faces/index.xhtml".
If the user requests "http://yourhost/your-app-context/faces/foo/x/y/" then the container will try to return the same result as if the the user had requested "http://yourhost/your-app-context/faces/foo/x/y/index.xhtml".
See §10.10 "Welcome Files" of the servlet spec for more details.
-
5. Re: welcome-file-list in web.xml is ignored ?
jaikiran May 28, 2013 12:58 AM (in response to sfcoy)I thought the welcome-file would take a mapped path too (like the faces/ in this case). In fact, I vaguely remember having some test application which did something similar (but that was many years back). Perhaps I was misusing that welcome-file list functionality. I'll have to read the servlet spec section you mentioned.
-
6. Re: welcome-file-list in web.xml is ignored ?
swd847 May 28, 2013 2:55 AM (in response to jaikiran)1 of 1 people found this helpfulYour case should work, as welcome file should also work against mapped servlets, and the spec does not say anything about not serving welcome files that have an additional slash in them. I will fix this in Undertow upstream.
-
7. Re: welcome-file-list in web.xml is ignored ?
sfcoy May 28, 2013 3:12 AM (in response to swd847)Of course you're correct. I'd attempted to get Radim's use case to work for myself in the distant past (> 10 years?) and concluded that additional slashes were not acceptable.
-
8. Re: welcome-file-list in web.xml is ignored ?
swd847 May 28, 2013 3:14 AM (in response to sfcoy)Its probably not a great idea, as if your page reference any relative resources such as javascript files or images they won't load, but it is still valid according to the spec.
-
9. Re: welcome-file-list in web.xml is ignored ?
rhanus May 28, 2013 4:44 AM (in response to sfcoy)I forgot to mention that this scenario works well in both jboss-as-7.1 and jboss-eap-6.1
I deployed the sample war in eap-6.1.0.Alpha1, tried to open http://localhost:8080/rf-jee6 and welcome page is displayed, faces servlet took over the control
note the last slash added