spring-mobile-device

org.springframework.mobile.device.site
Class SitePreferenceHandlerInterceptor

java.lang.Object
  extended by org.springframework.web.servlet.handler.HandlerInterceptorAdapter
      extended by org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor

public class SitePreferenceHandlerInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter

A Spring MVC interceptor that, on preHandle, delegates to a SitePreferenceHandler to resolve the SitePreference of the user that originated the web request. The resolved SitePreference is exported as a request attribute under the well-known name of SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE. Request handlers such as @Controllers and views may then access the currentSitePreference to vary their control and rendering logic, respectively. Note: do not use this interceptor in conjunction with the SiteSwitcherHandlerInterceptor, as the switcher internally delegates to a SitePreferenceHandler as part of its own workflow. This interceptor should only be used when site switching is not needed but site preference management is still desired.

Author:
Keith Donald

Constructor Summary
SitePreferenceHandlerInterceptor()
           
SitePreferenceHandlerInterceptor(SitePreferenceHandler sitePreferenceHandler)
           
 
Method Summary
 boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)
           
 
Methods inherited from class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
afterCompletion, postHandle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SitePreferenceHandlerInterceptor

public SitePreferenceHandlerInterceptor()

SitePreferenceHandlerInterceptor

public SitePreferenceHandlerInterceptor(SitePreferenceHandler sitePreferenceHandler)
Method Detail

preHandle

public boolean preHandle(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         java.lang.Object handler)
                  throws java.lang.Exception
Specified by:
preHandle in interface org.springframework.web.servlet.HandlerInterceptor
Overrides:
preHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
Throws:
java.lang.Exception

spring-mobile-device