In my web.xml, I use something like this:
<security-constraint> <web-resource-collection> <web-resource-name>Block all</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint /> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Allow facelets</web-resource-name> <url-pattern>/faces/*</url-pattern> <http-method>POST</http-method> <http-method>GET</http-method> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> </security-constraint>
All incoming requests are blocked, except for those starting with / faces /. I do this because otherwise unauthorized users can access the facelets source files.
It works fine, but the welcome file is not displayed, because even the root path is locked. I tried adding <url-pattern>/</url-pattern> to the second security constraint, but nothing.
source share