为欢迎页面的Servlet的web.xml认证
题
我有一个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://本地主机:8080 / 强>他们得到访问被拒绝,但如果转到 的http://本地主机:8080 / index.jsp的 强>它允许他们英寸两个网址应显示相同的页,并且两者都应该被允许。我在做什么错在这里?
解决方案
我觉得做事情会指定/*
赶上默认值,不喜欢/somethingElse.jsp
特定模式赶上那是的不的index.jsp的任何其他页面。希望您的顶级“目录”是不是很杂乱。
不隶属于 StackOverflow