In my project, I want to restrict direct URL access in my JSF web application. Although I found it on the web that give suggestions to configure security constraints in web.xml.
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>/manage/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint />
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
So that, I can restrict direct URL access to /manage/*.jsp
. But I have many folders to restrict such as /view/*.jsp
, /others/*.jsp
, etc. And I want to show error page when occur.
one way would be to move the jsp files inside the web-inf directory which will block direct url accesss