Module io.jstach.opt.spring.webmvc
Package io.jstach.opt.spring.webmvc
Class ViewSetupHandlerInterceptor
java.lang.Object
io.jstach.opt.spring.webmvc.ViewSetupHandlerInterceptor
- All Implemented Interfaces:
WebMvcConfigurer
,HandlerInterceptor
public class ViewSetupHandlerInterceptor
extends Object
implements HandlerInterceptor, WebMvcConfigurer
A
HandlerInterceptor
that automatically applies all
JStachioModelViewConfigurer
instances to views before rendering. Also
implements WebMvcConfigurer
so that it registers itself when the servlet
context starts.- Author:
- dsyer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInterceptors
(InterceptorRegistry registry) void
postHandle
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, ModelAndView modelAndView) If the modelAndView is aJStachioModelView
then it will be configured with all of the foundJStachioModelViewConfigurer
in the application context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion, preHandle
Methods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
addArgumentResolvers, addCorsMappings, addFormatters, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
-
Constructor Details
-
ViewSetupHandlerInterceptor
Injected context will be searched forJStachioModelViewConfigurer
- Parameters:
context
- autowired.
-
-
Method Details
-
postHandle
public void postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception If the modelAndView is aJStachioModelView
then it will be configured with all of the foundJStachioModelViewConfigurer
in the application context.- Specified by:
postHandle
in interfaceHandlerInterceptor
- Throws:
Exception
-
addInterceptors
- Specified by:
addInterceptors
in interfaceWebMvcConfigurer
-