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

public Class ConversionServiceExposingInterceptor

extends Object
implements HandlerInterceptor
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.HandlerInterceptor
Imports
java.io.IOException, jakarta.servlet.ServletException, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.core.convert.ConversionService, org.springframework.util.Assert, org.springframework.web.servlet.HandlerInterceptor

Interceptor that places the configured ConversionService in request scope so it's available during request processing. The request attribute name is "org.springframework.core.convert.ConversionService", the value of ConversionService.class.getName().

Mainly for use within JSP tags such as the spring:eval tag.

Author
Keith Donald
Since
3.0.1

Field Summary

Modifier and TypeField and Description
private final ConversionService

Constructor Summary

AccessConstructor and Description
public
ConversionServiceExposingInterceptor(ConversionService
the conversion service to export to request scope when this interceptor is invoked
conversionService
)

Creates a new ConversionServiceExposingInterceptor.

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

conversionServiceback to summary
private final ConversionService conversionService

Constructor Detail

ConversionServiceExposingInterceptorback to summary
public ConversionServiceExposingInterceptor(ConversionService conversionService)

Creates a new ConversionServiceExposingInterceptor.

Parameters
conversionService:ConversionService

the conversion service to export to request scope when this interceptor is invoked

Method Detail

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

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