* 목적
url을 통해 jsp를 바로 접근하는 것을 막고자 할 경우
* 내용
1.
WEB-INF 아래 JSP 폴더를 둠
구조 : WEB-INF/jsp/aaa.jsp
- WEB-INF
1. 클라이언트는 접근이 금지됨
2. 컨테이너는 접근이 허용됨
2.
web.xml 에서 .jsp 에 대한 접근에 권한을 넣기
<security-constraint>
<display-name>JSP Protection</display-name>
<web-resource-collection>
<web-resource-name>SecureJSPPages</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- nobody 로 할 경우 tomcat-user.xml 과 상관없이 무조건 에러를 발생시킨다. -->
<role-name>nobody</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>
Nobody should be in this role so JSP files are protected
from direct access.
</description>
<role-name>nobody</role-name>
</security-role>
<!--기본 tomcat login 창을 뜨어준다. 계정은 server/conf/tomcat-user.xml 을 참조한다.-->
<!--
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Tomcat Manager Application</realm-name>
</login-config>
-->
<error-page>
<error-code>401</error-code>
<location>/error/unauthorized.html</location>
</error-page>
* 참고url
http://www.okjsp.pe.kr/bbs?act=VIEW&seq=33603&bbs=bbs4&keyfield=content&keyword=error-page&pg=0