Struts2+Acegi整合的问题

jayjerry jayjerry 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
最近做个项目,整合了SSH和Acegi,在web.xml中配置了Acegi的拦截器在Struts2拦截器之前,现在其他一切都正常,只有一个问题:就是Acegi在验证权限失败后(也就是请求的url资源不是当前用户权限范围内的)转向的页面中不能有struts2的标签,只要有Struts2的标签,就会报错:The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter.

web.xml配置片段如下:
<!-- Acegi拦截器 -->
<filter>
<filter-name>AcegiFilterChainProxy</filter-name>
<filter-class>
org.acegisecurity.util.FilterToBeanProxy
</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>
org.acegisecurity.util.FilterChainProxy
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>AcegiFilterChainProxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Struts2拦截器 -->
<filter>
<filter-name>
struts2
</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>
struts2
</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


Acegi验证权限失败的配置片段如下:
<bean id="exceptionTranslationFilter"
class="org.acegisecurity.ui.ExceptionTranslationFilter">
<property name="authenticationEntryPoint">
<ref bean="authenticationProcessingFilterEntryPoint" />
</property>
<property name="accessDeniedHandler">
<bean
class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
<property name="errorPage" value="/accessDenied.jsp" />
</bean>
</property>
</bean>


...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
jayjerry
Java EE 67,535 成员 225,843 内容