【发布时间】:2010-12-26 17:12:50
【问题描述】:
我有一个 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 应该显示相同页面,并且两者都应该被允许。我在这里做错了什么?
【问题讨论】:
标签: java servlets jetty web.xml