public abstract class AbstractDeviceDelegatingViewResolver
extends org.springframework.web.context.support.WebApplicationObjectSupport
implements org.springframework.web.servlet.ViewResolver, org.springframework.core.Ordered
ViewResolver implementation, providing a device
aware ViewResolver wrapper that delegates to another view resolver
implementation, allowing for resolution of device specific view names without
the need for a dedicated mapping to be defined for each view.LiteDeviceDelegatingViewResolver| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FORWARD_URL_PREFIX
Prefix for special view names that specify a forward URL (usually
to a controller after a form has been submitted and processed).
|
static java.lang.String |
REDIRECT_URL_PREFIX
Prefix for special view names that specify a redirect URL (usually
to a controller after a form has been submitted and processed).
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDeviceDelegatingViewResolver(org.springframework.web.servlet.ViewResolver delegate)
Creates a new AbstractDeviceDelegatingViewResolver
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
getDeviceViewName(java.lang.String viewName)
Returns the adjusted view name as determined by subclass implementation.
|
protected abstract java.lang.String |
getDeviceViewNameInternal(java.lang.String viewName)
Subclasses must implement this method, adjusting the device view name
based on device resolution used within the subclass.
|
protected boolean |
getEnableFallback()
Return whether fallback view resolution is enabled
|
int |
getOrder() |
org.springframework.web.servlet.ViewResolver |
getViewResolver()
Returns the delegate view resolver
|
protected void |
initServletContext(javax.servlet.ServletContext servletContext) |
org.springframework.web.servlet.View |
resolveViewName(java.lang.String viewName,
java.util.Locale locale) |
void |
setEnableFallback(boolean enableFallback)
Enables support for fallback resolution, meaning if the adjusted view
name cannot be resolved, and attempt will be made to resolve the
original view name.
|
void |
setOrder(int order) |
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, isContextRequired, setServletContextpublic static final java.lang.String REDIRECT_URL_PREFIX
public static final java.lang.String FORWARD_URL_PREFIX
protected AbstractDeviceDelegatingViewResolver(org.springframework.web.servlet.ViewResolver delegate)
delegate - the ViewResolver in which to delegatepublic org.springframework.web.servlet.ViewResolver getViewResolver()
public void setOrder(int order)
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setEnableFallback(boolean enableFallback)
Note: fallback resolution will only work when delegating to a view
resolver which returns null from
resolveViewName(String, Locale) if it cannot resolve a view.
For example, InternalResourceViewResolver never returns null,
so fallback resolution will not be available.
protected boolean getEnableFallback()
setEnableFallback(boolean)public org.springframework.web.servlet.View resolveViewName(java.lang.String viewName,
java.util.Locale locale)
throws java.lang.Exception
resolveViewName in interface org.springframework.web.servlet.ViewResolverjava.lang.Exceptionprotected java.lang.String getDeviceViewName(java.lang.String viewName)
viewName - the name of the view before device resolutiongetDeviceViewNameInternal(String)protected abstract java.lang.String getDeviceViewNameInternal(java.lang.String viewName)
viewName - the name of the view before device resolutiongetDeviceViewName(String)protected void initServletContext(javax.servlet.ServletContext servletContext)
initServletContext in class org.springframework.web.context.support.WebApplicationObjectSupport