2014-10-01 23 views
0

嗨,朋友我工作會議在春季web流量,每個事件之前我想檢查會話是否存在或不爲這個我想要呼叫攔截器,所以我有問題配置攔截器在web流這裏id我的網絡流量。如何在Spring Web Flow的每個Dispatcher servlet之前調用攔截器?

<?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> 
+0

問題是?雖然我可以猜測你的攔截器沒有被解僱。您需要通過設置「攔截器」屬性將其設置在「FlowHandlerMapping」中。 ''將與''一起使用。 – 2014-10-01 05:55:01

+0

嗨@ M.Deinum你能解釋sir.how嗎? – user2189505 2014-10-01 06:13:29

+0

@ M.Deinum我已經配置了AOP,但我怎樣才能調用攔截器先生 – user2189505 2014-10-01 06:15:02

回答

0

<mvc:interceptors />是爲了與<mvc:annotation-driven />使用不正規配置HandlerMapping豆類工作。對於那些需要配置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> 
+0

謝謝先生的工作。 – user2189505 2014-10-01 07:33:12

+0

但先生當在無效的會議,如何可以註銷其他用戶時檢查會話 – user2189505 2014-10-01 07:42:20

+0

我不明白你的問題/評論。 – 2014-10-01 08:43:00