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
ConstructorDescriptionViewResolvingHandlerInterceptor
(JStachio jstachio) Spring will inject jstachio -
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 model contains an attribute that is aJStache
model, in particular if it has been the result of aController
method, 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, 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
-
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 aJStache
model, in particular if it has been the result of aController
method, then it will be automatically converted into aJStachioModelView
.- Specified by:
postHandle
in interfaceHandlerInterceptor
- Throws:
Exception
-
addInterceptors
- Specified by:
addInterceptors
in interfaceWebMvcConfigurer
-