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:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
,org.springframework.web.servlet.HandlerInterceptor
public class ViewSetupHandlerInterceptor
extends Object
implements org.springframework.web.servlet.HandlerInterceptor, org.springframework.web.servlet.config.annotation.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
ConstructorDescriptionViewSetupHandlerInterceptor
(org.springframework.context.ApplicationContext context) Injected context will be searched forJStachioModelViewConfigurer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInterceptors
(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) void
postHandle
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.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
equals, 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, org.springframework.web.servlet.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 interfaceorg.springframework.web.servlet.HandlerInterceptor
- Throws:
Exception
-
addInterceptors
public void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) - Specified by:
addInterceptors
in interfaceorg.springframework.web.servlet.config.annotation.WebMvcConfigurer
-