java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractCachingViewResolver
org.springframework.web.servlet.view.UrlBasedViewResolver
All Implemented Interfaces:
Ordered, ViewResolver, ServletContextAware, ApplicationContextAware
Direct Known Subclasses:
AbstractTemplateViewResolver, VelocityViewResolver, FreeMarkerViewResolver, InternalResourceViewResolver, VelocityLayoutViewResolver, XsltViewResolver, JasperReportsViewResolver
Supports AbstractUrlBasedView subclasses like InternalResourceView , org.springframework.web.servlet.view.velocity.VelocityView and org.springframework.web.servlet.view.freemarker.FreeMarkerView . The view class for all views generated by this resolver can be specified via the "viewClass" property.
View names can either be resource URLs themselves, or get augmented by a specified prefix and/or suffix. Exporting an attribute that holds the RequestContext to all views is explicitly supported.
Example: prefix="/WEB-INF/jsp/", suffix=".jsp", viewname="test" -> "/WEB-INF/jsp/test.jsp"
As a special feature, redirect URLs can be specified via the "redirect:" prefix. E.g.: "redirect:myAction.do" will trigger a redirect to the given URL, rather than resolution as standard view name. This is typically used for redirecting to a controller URL after finishing a form workflow.
Furthermore, forward URLs can be specified via the "forward:" prefix. E.g.: "forward:myAction.do" will trigger a forward to the given URL, rather than resolution as standard view name. This is typically used for controller URLs; it is not supposed to be used for JSP URLs - use logical view names there.
Note: This class does not support localized resolution, i.e. resolving a symbolic view name to different resources depending on the current locale.
Note: When chaining ViewResolvers, a UrlBasedViewResolver always needs to be last, as it will attempt to resolve any view name, no matter whether the underlying resource actually exists.
Juergen - HoellerRob - Harrop13.12.2003 - | Field Summary | ||
|---|---|---|
| public static final 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). Such view names will not be resolved in the configured default way but rather be treated as special shortcut. |
| public static final 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). Such view names will not be resolved in the configured default way but rather be treated as special shortcut. |
| Fields inherited from org.springframework.context.support.ApplicationObjectSupport: |
|---|
| logger |
| Method from org.springframework.web.servlet.view.UrlBasedViewResolver Summary: |
|---|
| buildView, canHandle, createView, getAttributesMap, getCacheKey, getContentType, getOrder, getPrefix, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, requiredViewClass, setAttributes, setAttributesMap, setContentType, setOrder, setPrefix, setRedirectContextRelative, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames |
| Methods from org.springframework.web.servlet.view.AbstractCachingViewResolver: |
|---|
| clearCache, createView, getCacheKey, isCache, loadView, removeFromCache, resolveViewName, setCache |
| Methods from org.springframework.web.context.support.WebApplicationObjectSupport: |
|---|
| getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
| Methods from org.springframework.context.support.ApplicationObjectSupport: |
|---|
| getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.web.servlet.view.UrlBasedViewResolver Detail: |
|---|
Spring lifecycle methods as defined by the bean container do not have to
be called here; those will be applied by the Subclasses will typically call |
null. The default implementation checks against the configured
view names . |
Not possible in |
Useful for specifying entries directly, for example via "attributesMap[myKey]". This is particularly useful for adding or overriding entries in child view definitions. |
|
|
|
|
|
|
|
|
|
|
|
buildView for creating a new instance of the
specified view class, and applies the following Spring lifecycle methods
(as supported by the generic Spring bean factory):
|
|
java.util.Properties object,
for all views returned by this resolver.
This is the most convenient way to set static attributes. Note that static attributes can be overridden by dynamic attributes, if a value with the same name is included in the model. Can be populated with a String "value" (parsed via PropertiesEditor) or a "props" element in XML bean definitions. |
Can be populated with a "map" or "props" element in XML bean definitions. |
May be ignored by view classes if the view itself is assumed to set the content type, e.g. in case of JSPs. |
|
|
Default is "true": A redirect URL that starts with a slash will be interpreted as relative to the web application root, i.e. the context path will be prepended to the URL. Redirect URLs can be specified via the "redirect:" prefix. E.g.: "redirect:myAction.do" |
In the default implementation, this will enforce HTTP status code 302
in any case, i.e. delegate to Many HTTP 1.1 clients treat 302 just like 303, not making any difference. However, some clients depend on 303 when redirecting after a POST request; turn this flag off in such a scenario. Redirect URLs can be specified via the "redirect:" prefix. E.g.: "redirect:myAction.do" |
|
|
|
|