Pergunta

I wonder if anyone can help. I am working on a Spring Webflow 2 app, where I would also like to integrate Spring Mobile 1.0 with WURFL 1.4.2.

I have got Webflow and Spring Mobile working together like this:

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

And then within one of my action classes I can do this:

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

This seems to work OK, but now I'd like to use WURFL with Spring Mobile so that I get a richer object representing the client capabilities.

This link suggests that I should be able to add a constructor to the DeviceResolverHandlerInterceptor like this:

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

And I define the device namespace as:

<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" >

As far as my IDE is concerned (Eclipse) it is happy, and it deploys to wtp no problem. But when I start wtp I get the following error:

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

I'm not really sure what this means. Any ideas anyone?

Appreciate any help you guys can offer,

Cheers, Nathan

Foi útil?

Solução

Had a look through the github repo to see if I could discern what happened: looks like WURFL support was deliberately removed due to licensing anomalies

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

This page alludes to a separate project which would provide WURFL support: I've not found it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top