Package org.springframework.web.servlet.view.script

# Class ScriptTemplateViewResolver

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractCachingViewResolver
org.springframework.web.servlet.view.UrlBasedViewResolver
org.springframework.web.servlet.view.script.ScriptTemplateViewResolver

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.context.ApplicationContextAware`, `org.springframework.core.Ordered`, `org.springframework.web.context.ServletContextAware`, `ViewResolver`

public class ScriptTemplateViewResolver extends UrlBasedViewResolver
Convenience subclass of `UrlBasedViewResolver` that supports `ScriptTemplateView` and custom subclasses of it.

The view class for all views created by this resolver can be specified via the `UrlBasedViewResolver.setViewClass(Class)` property.

Note: When chaining ViewResolvers this resolver will check for the existence of the specified template resources and only return a non-null View object if a template is actually found.

Since:
  4.2
Author:
  Sebastien Deleuze
See Also:
  - `ScriptTemplateConfigurer`

## Nested Class Summary

## Nested classes/interfaces inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

`AbstractCachingViewResolver.CacheFilter`

## Field Summary

### Fields inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver

`FORWARD_URL_PREFIX, REDIRECT_URL_PREFIX`

### Fields inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

`DEFAULT_CACHE_LIMIT`

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Fields inherited from interface org.springframework.core.Ordered

`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

## Constructor Summary

Constructors
Constructor
Description
`ScriptTemplateViewResolver()`
Sets the default `view class` to `requiredViewClass()`: by default `ScriptTemplateView`.
`ScriptTemplateViewResolver(String prefix, String suffix)`
A convenience constructor that allows for specifying `prefix` and `suffix` as constructor arguments.

## Method Summary

Modifier and Type
Method
Description
`protected AbstractUrlBasedView`
`instantiateView()`
Instantiate the specified view class.
`protected Class<?>`
`requiredViewClass()`
Return the required type of view for this resolver.

### Methods inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver

`applyLifecycleMethods, buildView, canHandle, createView, getAttributesMap, getCacheKey, getContentType, getExposeContextBeansAsAttributes, getExposedContextBeanNames, getExposePathVariables, getOrder, getPrefix, getRedirectHosts, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, setAttributes, setAttributesMap, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setOrder, setPrefix, setRedirectContextRelative, setRedirectHosts, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames`

### Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

`clearCache, getCacheFilter, getCacheLimit, isCache, isCacheUnresolved, removeFromCache, resolveViewName, setCache, setCacheFilter, setCacheLimit, setCacheUnresolved`

### Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext`

### Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

`getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ScriptTemplateViewResolver

public ScriptTemplateViewResolver()
Sets the default `view class` to `requiredViewClass()`: by default `ScriptTemplateView`.

### ScriptTemplateViewResolver

public ScriptTemplateViewResolver(String prefix, String suffix)
A convenience constructor that allows for specifying `prefix` and `suffix` as constructor arguments.

Parameters:
  `prefix` - the prefix that gets prepended to view names when building a URL
  `suffix` - the suffix that gets appended to view names when building a URL
Since:
  4.3

## Method Details

### requiredViewClass

protected Class<?> requiredViewClass()
Description copied from class: `UrlBasedViewResolver`
Return the required type of view for this resolver. This implementation returns `AbstractUrlBasedView`.

Overrides:
  `requiredViewClass` in class `UrlBasedViewResolver`
See Also:
  - `UrlBasedViewResolver.instantiateView()`
  - `AbstractUrlBasedView`

### instantiateView

protected AbstractUrlBasedView instantiateView()
Description copied from class: `UrlBasedViewResolver`
Instantiate the specified view class.

The default implementation uses reflection to instantiate the class.

Overrides:
  `instantiateView` in class `UrlBasedViewResolver`
Returns:
  a new instance of the view class
See Also:
  - `UrlBasedViewResolver.setViewClass(java.lang.Class<?>)`