我的 web.xml 中有以下安全约束
<security-constraint>
<display-name>Admin Pages</display-name>
<web-resource-collection>
<web-resource-name>Protected Admin Area</web-resource-name>
<description/>
<url-pattern>/administrator/*</url-pattern>
<url-pattern>/faces/backend/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>administrator</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
它工作正常。但我想重定向用户(已经登录的用户具有一些分配角色但不是角色管理员)。在这种情况下。当用户尝试访问 url http://mywebap//administrator/ * 他从服务器得到响应
403 Forbiden.
我不会在这里显示它,而是将用户重定向到一些更友好的视图。有可能的?