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
ConstructorsConstructorDescriptionViewSetupHandlerInterceptor(org.springframework.context.ApplicationContext context) Injected context will be searched forJStachioModelViewConfigurer -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) voidpostHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) If the modelAndView is aJStachioModelViewthen it will be configured with all of the foundJStachioModelViewConfigurerin the application context.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion, preHandleMethods 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 aJStachioModelViewthen it will be configured with all of the foundJStachioModelViewConfigurerin the application context.- Specified by:
postHandlein interfaceorg.springframework.web.servlet.HandlerInterceptor- Throws:
Exception
-
addInterceptors
public void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) - Specified by:
addInterceptorsin interfaceorg.springframework.web.servlet.config.annotation.WebMvcConfigurer
-