I have a web application that originally was a JSF app, but has been migrated to pure HTML/JavaScript. We are now in the progress of eliminating JSF completely.
We had the physical file main.xhtml, which was requested by "main.jsf", where the FacesServlet was declared in web.xml with url-mapping *.jsf.
We have moved the content to main.html, and put a meta-tag REFRESH in main.xhtml to redirect to main.html.
Now the problem is that even if I remove FacesServlet from web.xml, it still redirects the request for main.jsf to main.xhtml. If I rename the file main.xhtml to main.jsf, requesting main.jsf gives a 404, and the server log says it cannot find a file "main.jsp".
Now the question is: If it redirects *.jsf to *.jsp or *.xhtml even when there is no FacesServlet in web.xml, what is responsible for this redirections?
I'm using GlassFish 3.1.2.2.
When using JSF 2.0+ on a Servlet 3.0+ container, and there's no explicit
FacesServlet
registration in webapp's ownweb.xml
, then theFacesServlet
will during webapp's startup automatically be registered on URL patterns/faces/*
,*.faces
and*.jsf
.See also its javadoc:
JSF 2.3 will add
*.xhtml
URL pattern to the set (which is backported in Mojarra 2.2.11).If you want to stop this behavior, and you can't eliminate the triggers (e.g. still having a
faces-config.xml
), then your best bet is to explicitly registerFacesServlet
on*.xhtml
in webapp's ownweb.xml
. This will override the default auto registered URL patterns.