2012-09-23 37 views
2

我想知道是否有人可以提供幫助。我正在研究Spring Webflow 2應用程序,我也想將Spring Mobile 1.0與WURFL 1.4.2集成。如何集成Spring Webflow,Spring Mobile和WURFL

我有一個Webflow和Spring移動一起工作是這樣的:

<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
    <property name="order" value="1"/> 
    <property name="mappings"> 
     <value>/fnol=flowController</value> 
    </property> 
    <property name="interceptors"> 
     <list> 
      <bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor" /> 
     </list> 
    </property> 

然後我的動作類之一內我可以這樣做:

public Event startUp(RequestContext arg0) throws Exception { 
    // get the http request form the webflow RequestContext 
    ServletExternalContext externalContext = (ServletExternalContext) arg0.getExternalContext(); 
    HttpServletRequest request = (HttpServletRequest) externalContext.getNativeRequest(); 
    // get the Spring Mobile Device 
    Device currentDevice = DeviceUtils.getCurrentDevice(request); 

這似乎工作確定,但現在我想在Spring Mobile中使用WURFL,以便獲得代表客戶端功能的更豐富的對象。

This link建議我應該能夠構造函數添加到DeviceResolverHandlerInterceptor這樣的:

<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> 
    <property name="order" value="1"/> 
    <property name="mappings"> 
     <value>/fnol=flowController</value> 
    </property> 
    <property name="interceptors"> 
     <list> 
      <bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor"> 
       <constructor-arg> 
        <device:wurfl-device-resolver root-location="/WEB-INF/wurfl/wurfl.zip" /> 
       </constructor-arg> 
      </bean> 
     </list> 
    </property> 

而且我定義了設備命名空間爲:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:webflow="http://www.springframework.org/schema/webflow-config" 
    xmlns:device="http://www.springframework.org/schema/mobile/device" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
         http://www.springframework.org/schema/context 
         http://www.springframework.org/schema/context/spring-context-3.0.xsd 
         http://www.springframework.org/schema/webflow-config 
         http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd 
         http://www.springframework.org/schema/mobile/device 
         http://www.springframework.org/schema/mobile/device/spring-mobile-device-1.0.xsd" > 

至於我的IDE關注(Eclipse)很高興,它部署到沒有問題。但是當我開始wtp我得到以下錯誤:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mobile/device] 
Offending resource: class path resource [fnol-webContext.xml] 
Bean 'handlerMapping' 
-> Property 'interceptors' 
    -> Bean '' 
     -> Constructor-arg 

我不確定這是什麼意思。任何想法的人?

欣賞你們可以提供任何幫助,

歡呼聲,彌敦道

回答