http://docs.spring.io/spring-mobile/docs/current/reference/html/device.html
유용햇!
DeviceResolverHandlerInterceptor
Spring Mobile ships with a HandlerInterceptor
that, on preHandle
, delegates to a DeviceResolver
. The resolved Device
is indexed under a request attribute named 'currentDevice', making it available to handlers throughout request processing.
To enable, add the DeviceResolverHandlerInterceptor
to the list of interceptors defined in your DispatcherServlet
configuration:
<interceptors> <!-- On pre-handle, resolve the device that originated the web request --> <bean class="org.springframework.mobile.device.DeviceResolverHandlerInterceptor" /> </interceptors>
Alternatively, you can add the DeviceResolverHandlerInterceptor
using Spring's Java-based container configuration:
@Bean public DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor() { return new DeviceResolverHandlerInterceptor(); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(deviceResolverHandlerInterceptor()); }
반응형
'emotional developer > detect-Java' 카테고리의 다른 글
[spring] basePackages vs basePackageClasses (0) | 2015.06.19 |
---|---|
[spring] WebMvcConfigurerAdapter vs WebMvcConfigurationSupport (0) | 2015.06.18 |
string.format 성능. (0) | 2015.06.08 |