【问题标题】:How to integrate Spring Webflow, Spring Mobile and WURFL如何集成 Spring Webflow、Spring Mobile 和 WURFL
【发布时间】:2012-11-16 06:37:00
【问题描述】:

我想知道是否有人可以提供帮助。我正在开发一个 Spring Webflow 2 应用程序,我还想将 Spring Mobile 1.0 与 WURFL 1.4.2 集成。

我已经让 Webflow 和 Spring Mobile 像这样一起工作:

<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);

这似乎工作正常,但现在我想将 WURFL 与 Spring Mobile 一起使用,以便获得表示客户端功能的更丰富的对象。

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 没有问题。但是当我启动 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

我不太确定这意味着什么。有什么想法吗?

感谢你们提供的任何帮助,

干杯,内森

【问题讨论】:

    标签: spring-webflow-2 wurfl spring-mobile


    【解决方案1】:

    查看了 github 存储库,看看我是否能看出发生了什么:看起来 WURFL 支持由于许可异常而被故意删除

    https://github.com/SpringSource/spring-mobile/commit/ca81c6c20f1a9e524b0150e14dab20b020676e0b

    这个页面暗示了一个单独的项目,它将提供 WURFL 支持:我还没有找到它。

    【讨论】:

      猜你喜欢
      • 2015-11-08
      • 1970-01-01
      • 2010-09-24
      • 1970-01-01
      • 2011-03-30
      • 1970-01-01
      • 1970-01-01
      • 2017-01-01
      • 2016-07-26
      相关资源
      最近更新 更多