![](/img/trans.png)
[英]How to configure Spring to call an image serving servlet from the dispatcher servlet?
[英]How to call interceptor before every Dispatcher servlet in spring web flow?
嗨,朋友們,我正在春季Web流程中工作,在我想要檢查會話的每個事件存在或不存在之前,我都希望調用攔截器,因此我在配置Web流程中的ID的Web流程時遇到問題。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:faces="http://www.springframework.org/schema/faces"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<faces:resources />
<context:annotation-config />
<context:component-scan base-package="com.pcx.interceptor.check" />
<context:component-scan base-package="com.pcx.ui.converter" />
<mvc:interceptors>
<bean class="com.pcx.ui.converter.ExecuteTimeInterceptor" />
</mvc:interceptors>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="order" value="1" />
<property name="flowRegistry" ref="flowRegistry" />
<property name="defaultHandler">
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</property>
</bean>
<!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search'
to '/WEB-INF/search.xhtml' -->
<bean id="faceletsViewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView" />
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".xhtml" />
</bean>
<!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller
implementations -->
<bean id="sssssssss"
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<!-- Dispatches requests mapped to flows to FlowHandler implementations -->
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
</beans>
<mvc:interceptors />
應該與<mvc:annotation-driven />
,不適用於常規配置的HandlerMapping
Bean。 對於那些,您需要配置其interceptors
屬性。
要解決您的問題,請除去<mvc:interceptors />
並將配置添加到FlowHandlerMapping
bean。
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="order" value="1" />
<property name="flowRegistry" ref="flowRegistry" />
<property name="interceptors">
<bean class="com.pcx.ui.converter.ExecuteTimeInterceptor"/>
</property>
<property name="defaultHandler">
<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
</property>
</bean>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.