我有一个 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 应该显示相同的页面,并且两者应该被允许。我在这里做错了什么?