spring-framework / org.springframework.web.servlet.mvc / WebContentInterceptor

WebContentInterceptor

open class WebContentInterceptor : WebContentGenerator, HandlerInterceptor

Handler interceptor that checks the request and prepares the response. Checks for supported methods and a required session, and applies the specified org.springframework.http.CacheControl builder. See superclass bean properties for configuration options.

All the settings supported by this interceptor can also be set on AbstractController. This interceptor is mainly intended for applying checks and preparations to a set of controllers mapped by a HandlerMapping.

Author
Juergen Hoeller

Author
Brian Clozel

Since
27.11.2003

See Also
AbstractController

Constructors

<init>

WebContentInterceptor()

Functions

addCacheMapping

open fun addCacheMapping(cacheControl: CacheControl, vararg paths: String): Unit

Map specific URL paths to a specific org.springframework.http.CacheControl.

Overrides the default cache seconds setting of this interceptor. Can specify a empty org.springframework.http.CacheControl instance to exclude a URL path from default caching.

Supports direct matches, e.g. a registered "/test" matches "/test", and a various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher javadoc.

NOTE: Path patterns are not supposed to overlap. If a request matches several mappings, it is effectively undefined which one will apply (due to the lack of key ordering in the underlying java.util.HashMap).

afterCompletion

open fun afterCompletion(request: HttpServletRequest, response: HttpServletResponse, handler: Any, ex: Exception): Unit

This implementation is empty.

postHandle

open fun postHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any, modelAndView: ModelAndView): Unit

This implementation is empty.

preHandle

open fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean

setAlwaysUseFullPath

open fun setAlwaysUseFullPath(alwaysUseFullPath: Boolean): Unit

Shortcut to same property on underlying UrlPathHelper.

Only relevant for the "cacheMappings" setting.

setCacheMappings

open fun setCacheMappings(cacheMappings: Properties): Unit

Map specific URL paths to specific cache seconds.

Overrides the default cache seconds setting of this interceptor. Can specify "-1" to exclude a URL path from default caching.

Supports direct matches, e.g. a registered "/test" matches "/test", and a various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher javadoc.

NOTE: Path patterns are not supposed to overlap. If a request matches several mappings, it is effectively undefined which one will apply (due to the lack of key ordering in java.util.Properties).

setPathMatcher

open fun setPathMatcher(pathMatcher: PathMatcher): Unit

Set the PathMatcher implementation to use for matching URL paths against registered URL patterns, for determining cache mappings. Default is AntPathMatcher.

setUrlDecode

open fun setUrlDecode(urlDecode: Boolean): Unit

Shortcut to same property on underlying UrlPathHelper.

Only relevant for the "cacheMappings" setting.

setUrlPathHelper

open fun setUrlPathHelper(urlPathHelper: UrlPathHelper): Unit

Set the UrlPathHelper to use for resolution of lookup paths.

Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple HandlerMappings and MethodNameResolvers.

Only relevant for the "cacheMappings" setting.