|
spring-mobile-device | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.web.servlet.handler.HandlerInterceptorAdapter
org.springframework.mobile.device.switcher.SiteSwitcherHandlerInterceptor
public class SiteSwitcherHandlerInterceptor
A Spring MVC interceptor that switches the user between the mobile and normal site by employing a specific switching algorithm. The switching algorithm is as follows:
| Constructor Summary | |
|---|---|
SiteSwitcherHandlerInterceptor(SiteUrlFactory normalSiteUrlFactory,
SiteUrlFactory mobileSiteUrlFactory,
SitePreferenceHandler sitePreferenceHandler)
Creates a new site switcher. |
|
| Method Summary | |
|---|---|
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 |
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. |
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler)
|
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. |
| 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 |
|---|
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 preference| Method Detail |
|---|
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.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 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 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)
CookieSitePreferenceRepository that saves a cookie that is stored on the root path.
|
spring-mobile-device | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||