문제

나는 다음과 같은 Web.xml이 있습니다.

<web-app>

<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Default</web-resource-name>
    <url-pattern>/</url-pattern>
  </web-resource-collection>
  <auth-constraint/>
</security-constraint>

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Index page</web-resource-name>
    <url-pattern>/index.jsp</url-pattern>
    <url-pattern>/</url-pattern>
    <http-method>GET</http-method>
    <http-method>HEAD</http-method>
  </web-resource-collection>
</security-constraint>
...

기본적으로 리소스에 대한 액세스를 거부하고 액세스 할 수있는 리소스를 지정하려고합니다.

사용자가 가면 http : // localhost : 8080/ 그러나 이동하면 접근이 거부됩니다. http : // localhost : 8080/index.jsp 그것은 그것들을 허용합니다. 두 URL 모두 동일한 페이지를 표시해야하며, 둘 다 허용되어야합니다. 여기서 내가 뭘 잘못하고 있니?

도움이 되었습니까?

해결책

해야 할 일은 /* 기본값을 잡고 같은 특정 패턴을 수행하려면 /somethingElse.jsp 다른 페이지를 잡으려고합니다 ~ 아니다 index.jsp. 바라건대 당신의 최상위 "디렉토리"가 그다지 혼란스럽지 않기를 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top