Как интегрировать Spring Webflow, Spring Mobile и WURFL
Интересно, кто-нибудь может помочь. Я работаю над приложением 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, чтобы получить более богатый объект, представляющий возможности клиента.
Эта ссылка предполагает, что я должен иметь возможность добавить конструктор к 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
Я не совсем уверен, что это значит. Любые идеи кто-нибудь?
Цените любую помощь, которую вы, ребята, можете предложить,
Ура, Натан
1 ответ
Посмотрел репозиторий github, чтобы узнать, смогу ли я понять, что произошло: похоже, что поддержка WURFL была преднамеренно удалена из-за лицензионных аномалий
https://github.com/SpringSource/spring-mobile/commit/ca81c6c20f1a9e524b0150e14dab20b020676e0b
Эта страница ссылается на отдельный проект, который обеспечит поддержку WURFL: я не нашел его.