2012-09-23 40 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 

我不确定这是什么意思。任何想法的人?

欣赏你们可以提供任何帮助,

欢呼声,弥敦道

回答