public class SiteSwitcherHandlerInterceptor extends HandlerInterceptorAdapter
Constructor and Description |
---|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler)
Creates a new site switcher.
|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler,
Boolean tabletIsMobile)
Creates a new site switcher.
|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SiteUrlFactory tabletSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler)
Creates a new site switcher.
|
Modifier and Type | Method and Description |
---|---|
static SiteSwitcherHandlerInterceptor |
dotMobi(String serverName)
Creates a site switcher that redirects to a
.mobi domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference. |
static SiteSwitcherHandlerInterceptor |
dotMobi(String serverName,
Boolean tabletIsMobile)
Creates a site switcher that redirects to a
.mobi domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference. |
static SiteSwitcherHandlerInterceptor |
mDot(String serverName)
Creates a site switcher that redirects to a
m. domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference. |
static SiteSwitcherHandlerInterceptor |
mDot(String serverName,
Boolean tabletIsMobile)
Creates a site switcher that redirects to a
m. domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference. |
boolean |
preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler) |
static SiteSwitcherHandlerInterceptor |
standard(String normalServerName,
String mobileServerName,
String cookieDomain)
Creates a site switcher that redirects to a custom domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
|
static SiteSwitcherHandlerInterceptor |
standard(String normalServerName,
String mobileServerName,
String cookieDomain,
Boolean tabletIsMobile)
Creates a site switcher that redirects to a custom domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
|
static SiteSwitcherHandlerInterceptor |
standard(String normalServerName,
String mobileServerName,
String tabletServerName,
String cookieDomain)
Creates a site switcher that redirects to a custom domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
|
static SiteSwitcherHandlerInterceptor |
urlPath(String mobilePath)
Creates a site switcher that redirects to a path on the current domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
|
static SiteSwitcherHandlerInterceptor |
urlPath(String mobilePath,
String rootPath)
Creates a site switcher that redirects to a path on the current domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
|
static SiteSwitcherHandlerInterceptor |
urlPath(String mobilePath,
String tabletPath,
String rootPath)
Creates a site switcher that redirects to a path on the current domain for normal site requests that either
originate from a mobile device or tablet device, or indicate a mobile or tablet site preference.
|
afterCompletion, afterConcurrentHandlingStarted, postHandle
public SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory, SiteUrlFactory mobileSiteUrlFactory, SitePreferenceHandler sitePreferenceHandler)
normalSiteUrlFactory
- the factory for a "normal" site URL e.g. http://app.commobileSiteUrlFactory
- the factory for a "mobile" site URL e.g. http://m.app.comsitePreferenceHandler
- the handler for the user site preferencepublic SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory, SiteUrlFactory mobileSiteUrlFactory, SitePreferenceHandler sitePreferenceHandler, Boolean tabletIsMobile)
normalSiteUrlFactory
- the factory for a "normal" site URL e.g. http://app.commobileSiteUrlFactory
- the factory for a "mobile" site URL e.g. http://m.app.comsitePreferenceHandler
- the handler for the user site preferencetabletIsMobile
- true to send tablets to the 'mobile' site.public SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory, SiteUrlFactory mobileSiteUrlFactory, SiteUrlFactory tabletSiteUrlFactory, SitePreferenceHandler sitePreferenceHandler)
normalSiteUrlFactory
- the factory for a "normal" site URL e.g. http://app.commobileSiteUrlFactory
- the factory for a "mobile" site URL e.g. http://m.app.comtabletSiteUrlFactory
- the factory for a "tablet" site URL e.g. http://app.com/tabletsitePreferenceHandler
- the handler for the user site preferencepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
preHandle
in interface HandlerInterceptor
preHandle
in class HandlerInterceptorAdapter
Exception
public static SiteSwitcherHandlerInterceptor mDot(String serverName)
m.
domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
Uses a CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.public static SiteSwitcherHandlerInterceptor mDot(String serverName, Boolean tabletIsMobile)
m.
domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
Uses a CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.public static SiteSwitcherHandlerInterceptor dotMobi(String serverName)
.mobi
domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
Will strip off the trailing domain name when building the mobile domain
e.g. "app.com" will become "app.mobi" (the .com will be stripped).
Uses a CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.public static SiteSwitcherHandlerInterceptor dotMobi(String serverName, Boolean tabletIsMobile)
.mobi
domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
Will strip off the trailing domain name when building the mobile domain
e.g. "app.com" will become "app.mobi" (the .com will be stripped).
Uses a CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.public static SiteSwitcherHandlerInterceptor standard(String normalServerName, String mobileServerName, String cookieDomain)
CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.normalServerName
- the 'normal' domain name e.g. "normal.com"mobileServerName
- the 'mobile domain name e.g. "mobile.com"cookieDomain
- the name to use for saving the cookiestandard(String, String, String, Boolean)
,
standard(String, String, String, String)
,
StandardSiteUrlFactory
public static SiteSwitcherHandlerInterceptor standard(String normalServerName, String mobileServerName, String cookieDomain, Boolean tabletIsMobile)
CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.normalServerName
- the 'normal' domain name e.g. "normal.com"mobileServerName
- the 'mobile domain name e.g. "mobile.com"cookieDomain
- the name to use for saving the cookietabletIsMobile
- true if tablets should be presented with the 'mobile' sitestandard(String, String, String)
,
standard(String, String, String, String)
,
StandardSiteUrlFactory
public static SiteSwitcherHandlerInterceptor standard(String normalServerName, String mobileServerName, String tabletServerName, String cookieDomain)
CookieSitePreferenceRepository
that saves a cookie that is shared between the two domains.normalServerName
- the 'normal' domain name e.g. "normal.com"mobileServerName
- the 'mobile domain name e.g. "mobile.com"tabletServerName
- the 'tablet' domain name e.g. "tablet.com"cookieDomain
- the name to use for saving the cookiestandard(String, String, String)
,
standard(String, String, String, Boolean)
,
StandardSiteUrlFactory
public static SiteSwitcherHandlerInterceptor urlPath(String mobilePath)
CookieSitePreferenceRepository
that saves a cookie that is stored on the root path.public static SiteSwitcherHandlerInterceptor urlPath(String mobilePath, String rootPath)
http://www.domain.com/myapp
,
then the root path is /myapp
.
Uses a CookieSitePreferenceRepository
that saves a cookie that is stored on the root path.public static SiteSwitcherHandlerInterceptor urlPath(String mobilePath, String tabletPath, String rootPath)
http://www.domain.com/myapp
,
then the root path is /myapp
.
Uses a CookieSitePreferenceRepository
that saves a cookie that is stored on the root path.