Top Description Fields Constructors Methods
org.springframework.web.servlet.resource

public Class ResourceUrlProviderExposingInterceptor

extends Object
implements HandlerInterceptor
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.HandlerInterceptor
Imports
jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.util.Assert, org.springframework.web.bind.ServletRequestBindingException, org.springframework.web.servlet.HandlerInterceptor

An interceptor that exposes the ResourceUrlProvider instance it is configured with as a request attribute.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
public static final String
RESOURCE_URL_PROVIDER_ATTR

Name of the request attribute that holds the ResourceUrlProvider.

private final ResourceUrlProvider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
preHandle(HttpServletRequest
current HTTP request
request
,
HttpServletResponse
current HTTP response
response
,
Object
chosen handler to execute, for type and/or instance evaluation
handler
)

Overrides default org.springframework.web.servlet.HandlerInterceptor.preHandle.

Interception point before the execution of a handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

RESOURCE_URL_PROVIDER_ATTRback to summary
public static final String RESOURCE_URL_PROVIDER_ATTR

Name of the request attribute that holds the ResourceUrlProvider.

resourceUrlProviderback to summary
private final ResourceUrlProvider resourceUrlProvider

Constructor Detail

ResourceUrlProviderExposingInterceptorback to summary
public ResourceUrlProviderExposingInterceptor(ResourceUrlProvider resourceUrlProvider)

Method Detail

preHandleback to summary
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception

Overrides default org.springframework.web.servlet.HandlerInterceptor.preHandle.

Doc from org.springframework.web.servlet.HandlerInterceptor.preHandle.

Interception point before the execution of a handler. Called after HandlerMapping determined an appropriate handler object, but before HandlerAdapter invokes the handler.

DispatcherServlet processes a handler in an execution chain, consisting of any number of interceptors, with the handler itself at the end. With this method, each interceptor can decide to abort the execution chain, typically sending an HTTP error or writing a custom response.

Note

special considerations apply for asynchronous request processing. For more details see org.springframework.web.servlet.AsyncHandlerInterceptor.

The default implementation returns true.

Parameters
request:HttpServletRequest

current HTTP request

response:HttpServletResponse

current HTTP response

handler:Object

chosen handler to execute, for type and/or instance evaluation

Returns:boolean

true if the execution chain should proceed with the next interceptor or the handler itself. Else, DispatcherServlet assumes that this interceptor has already dealt with the response itself.

Annotations
@Override
Exceptions
Exception:
in case of errors