Reputation: 110
I have a JSF2 app and I would like to show only the domain name in the Browser for every page. Example:
http://www.example.com/index.jsf to http://www.example.com
Therefore I configured PrettyFaces like this:
<url-mapping id="index">
<pattern value="/" />
<view-id value="/index.jsf"/>
</url-mapping>
But then, I get the 404 error message "The requested resource (/index.jsf/) is not available."
If I try to use "/test" as pattern, then it works for www.example.com/test.
The following files are present in web-root:
index.xhtml
index.html
The index.html contains the redirect
<meta http-equiv="Refresh" content="0; URL=index.jsf">
Thank you very much.
PS: PrettyFaces 3.3.2, JSF 2, PrimeFaces 3.1.1
EDIT: I got it work! I needed to delete the browser cache. I don't know why... but it helped. Thank you for your answers anyway!
Upvotes: 0
Views: 743
Reputation: 3191
Browsers frequently cache 301 redirects so that they do not need to contact the old address in the future. Clearing your browser cache is the only way you can force your browser to contact the original URL again.
Upvotes: 0
Reputation: 1108732
I have no idea about the PrettyFaces part, but you can also just change the FacesServlet
mapping from *.jsf
to *.xhtml
and then use <welcome-file>index.xhtml</welcome-file>
instead and get rid of that hacky index.html
. This way you don't need to fiddle with virtual URLs and you also profit from the container's builtin welcome file facility.
Upvotes: 1