gpt4 book ai didi

java - 在 web.xml 安全约束中配置异常

转载 作者:行者123 更新时间:2023-11-28 22:25:36 24 4
gpt4 key购买 nike

我知道已经有其他帖子类似我的疑问,但问题是我无法解决问题。我有一个必须使用名称“passport.jsp”映射的 servlet,因为外部应用程序(无法更改调用)通过 URL 发出请求 http://myipserver:portserver/nameApplication/passport.jsp?xxx我的 web.xml 在这里:

<servlet-mapping>
<servlet-name>PortalServlet</servlet-name>
<url-pattern>/passport.jsp</url-pattern>
</servlet-mapping>

问题是我的安全约束的映射覆盖了 servlet passport.jsp 的定义,因为是映射“*.jsp”。

<security-constraint>
<display-name>EsconderJSP</display-name>
<web-resource-collection>
<web-resource-name>JSP</web-resource-name>
<description/>
<url-pattern>*.jsp</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>jsps</role-name>
</auth-constraint>
</security-constraint>

有人知道怎么解决吗?您可以添加 servlet“/passport.jsp”作为异常(exception)。

感谢您的关注。

最佳答案

我解决了在我的 web.xml 中添加一个新标签(其他安全约束)

<security-constraint>
<web-resource-collection>
<web-resource-name>free pages</web-resource-name>
<url-pattern>/passport.jsp</url-pattern>
</web-resource-collection>
</security-constraint>

安,它正在工作。谢谢

关于java - 在 web.xml 安全约束中配置异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46729004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com