public class SiteSwitcherHandlerInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
| Constructor and Description |
|---|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler)
Creates a new site switcher.
|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler,
java.lang.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(java.lang.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(java.lang.String serverName,
java.lang.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(java.lang.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(java.lang.String serverName,
java.lang.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(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler) |
static SiteSwitcherHandlerInterceptor |
standard(java.lang.String normalServerName,
java.lang.String mobileServerName,
java.lang.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(java.lang.String normalServerName,
java.lang.String mobileServerName,
java.lang.String cookieDomain,
java.lang.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(java.lang.String normalServerName,
java.lang.String mobileServerName,
java.lang.String tabletServerName,
java.lang.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(java.lang.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(java.lang.String mobilePath,
java.lang.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(java.lang.String mobilePath,
java.lang.String tabletPath,
java.lang.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.
|
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, java.lang.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(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.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterjava.lang.Exceptionpublic static SiteSwitcherHandlerInterceptor mDot(java.lang.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(java.lang.String serverName, java.lang.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(java.lang.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(java.lang.String serverName, java.lang.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(java.lang.String normalServerName, java.lang.String mobileServerName, java.lang.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),
StandardSiteUrlFactorypublic static SiteSwitcherHandlerInterceptor standard(java.lang.String normalServerName, java.lang.String mobileServerName, java.lang.String cookieDomain, java.lang.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),
StandardSiteUrlFactorypublic static SiteSwitcherHandlerInterceptor standard(java.lang.String normalServerName, java.lang.String mobileServerName, java.lang.String tabletServerName, java.lang.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),
StandardSiteUrlFactorypublic static SiteSwitcherHandlerInterceptor urlPath(java.lang.String mobilePath)
CookieSitePreferenceRepository that saves a cookie that is stored on the root path.public static SiteSwitcherHandlerInterceptor urlPath(java.lang.String mobilePath, java.lang.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(java.lang.String mobilePath, java.lang.String tabletPath, java.lang.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.