Module io.jstach.opt.spring.webmvc
Package io.jstach.opt.spring.webmvc
Class ViewResolvingHandlerInterceptor
java.lang.Object
io.jstach.opt.spring.webmvc.ViewResolvingHandlerInterceptor
- All Implemented Interfaces:
WebMvcConfigurer,HandlerInterceptor
public class ViewResolvingHandlerInterceptor
extends Object
implements HandlerInterceptor, WebMvcConfigurer
A
HandlerInterceptor to automatically resolve a Controller method
return value that is a JStache model into a JStachioModelView.- Author:
- dsyer
-
Constructor Summary
ConstructorsConstructorDescriptionViewResolvingHandlerInterceptor(JStachio jstachio) Spring will inject jstachio -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptors(InterceptorRegistry registry) voidpostHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, ModelAndView modelAndView) If the model contains an attribute that is aJStachemodel, in particular if it has been the result of aControllermethod, then it will be automatically converted into aJStachioModelView.Methods inherited from class java.lang.Object
clone, equals, finalize, 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
-
ViewResolvingHandlerInterceptor
Spring will inject jstachio- Parameters:
jstachio- jstachio instance found by spring.
-
-
Method Details
-
postHandle
public void postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception If the model contains an attribute that is aJStachemodel, in particular if it has been the result of aControllermethod, then it will be automatically converted into aJStachioModelView.- Specified by:
postHandlein interfaceHandlerInterceptor- Throws:
Exception
-
addInterceptors
- Specified by:
addInterceptorsin interfaceWebMvcConfigurer
-