When you use JSF, you'll have the controller servlet javax.faces.webapp.FacesServlet that will be mapped to the following:
<servlet-mapping>
...
<url-pattern>/somefacesurl/*</url-pattern>
</servlet-mapping>
Putting a mypage.xhtml in /, we have a security risk because it will be accessed in two ways (starting from the application context):
1) /somefacesurl/mypage.xhtml
2) /mypages.xhtml
The first is processed by jsf, and is correct. The second is not processed by jsf and so is presented to the client exposing jsf tags and this is a security risk.
I've found only two solutions
1) mapping always to the root url:
<servlet-mapping>
...
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Good solution but permits only mappings by file extension.
2) Map to whatever url, and use security constraint to disallow access to those files as suggested in: How to avoid user access to .xhtml page in JSF?
Both solutions are presented in the JSF 2.0 spec as viable alternatives, BUT there is no word about the different security approach of the two solutions.
Since security is NOT considered, i wonder if the first is "secure" from the point of view of access to the xhtml files or perhaps there is an hack to get the .xhtml sources.