public class SitePreferenceHandlerInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
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.Constructor and Description |
---|
SitePreferenceHandlerInterceptor() |
SitePreferenceHandlerInterceptor(SitePreferenceHandler sitePreferenceHandler) |
Modifier and Type | Method and Description |
---|---|
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler) |
public SitePreferenceHandlerInterceptor()
public SitePreferenceHandlerInterceptor(SitePreferenceHandler sitePreferenceHandler)
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
preHandle
in interface org.springframework.web.servlet.HandlerInterceptor
preHandle
in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
java.lang.Exception