About

SpringMobileModule activates support for Spring Mobile in the Across context. By default ViewResolver beans will be configured for device specific views and DeviceType resolving will be enabled.

1. General information

1.1. Artifact

<dependencies>
    <dependency>
        <groupId>com.foreach.across.modules</groupId>
        <artifactId>spring-mobile-module</artifactId>
        <version>1.0.1.RELEASE</version>
    </dependency>
</dependencies>

1.2. Module dependencies

SpringMobileModule only has a required dependency on AcrossWebModule.

1.3. Module settings

Property Type Description Default

springMobile.deviceResolverRegistration

DeviceResolverRegistration.class

Register the DeviceResolver as servlet filter or handler interceptor.

DeviceResolverRegistration.FILTER

springMobile.deviceTypes

DeviceType[].class

Device types for which view resolving should be configured.

{DeviceType.MOBILE, DeviceType.TABLET}

2. What’s new in this version?

1.0.1.RELEASE

  • refactored to support Across 1.1.2 (breaking change)

  • settings are now configurable through properties with Spring configuration metadata support

1.0.0.RELEASE

Initial public release available on Maven central.

3. Configuration

By default the SpringMobileModule will configure the Across web ViewResolver beans to look for /mobile and /tablet specific views with fallback options. A LiteDeviceResolver will also be available along with a DeviceWebArgumentResolver. A DeviceBasedViewNameResolver can be wired to prepend view names with the prefix of the current device.

Once the SpringMobileModule is active, Thymeleaf and/or JSP views with the right prefixes will automatically be picked up.

3.1. Settings

The springMobile.deviceResolverRegistration property can be used to determine how the DeviceResolver should be registered. The resolver can be registered as a Servlet Filter for all servlets (default) or as a HandlerInterceptor. When registered as a HandlerInterceptor, the interceptor will apply to all prefixing contexts (this includes for example AdminWeb and DebugWeb).

The springMobile.deviceTypes property determines the list of DeviceType instances that are supported. View resolving for these types will be enabled.

4. Thymeleaf DeviceDialect

To use device-specific Thymeleaf fragments, a DeviceDialect is added. This allows the usage of the device:replace attribute which will replace the host tag by the device-specific fragment. Using device:replace is a drop-in alternative to th:replace for device-specific view support.