- All Superinterfaces:
- View
- All Known Implementing Classes:
- HelloModelAndView
Another way to use JStachio with Spring MVC is to have models implement Springs
 
View interface. You can enforce that your models implement this interface with
 JStacheInterfaces. Alternatively one can call of(Object) on the model
 and return the result.
 This view will by default use the static jstachio singleton and if configured correctly that will be the spring version.
 This approach has pros and cons. It makes your models slightly coupled to Spring MVC
 but allows you to return different views if say you had to redirect on some inputs
 (RedirectView).
- Author:
- agentgt
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe default buffer limit before bailing on trying to setContent-Length.static final MediaTypeThe default media type is "text/html; charset=UTF-8".Fields inherited from interface org.springframework.web.servlet.ViewPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
- 
Method SummaryModifier and TypeMethodDescriptiondefault Output.CloseableEncodedOutput<IOException>createOutput(Charset charset, jakarta.servlet.http.HttpServletResponse response) Creates the output from the servlet response to use for rendering.default Stringdefault MediaTypeThe media type for this view.default ContextJStachiojstachio()Returns the jstachio singleton by default.default Objectmodel()The model to be rendered byjstachio().static JStachioModelViewCreates a spring view from a model with content type: "text/html; charset=UTF-8".static JStachioModelViewCreates a spring view from a model.static JStachioModelViewCreates a spring view from a model.static JStachioModelViewCreates a spring view from a model.default voidrender(Map<String, ?> model, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 
- 
Field Details- 
DEFAULT_MEDIA_TYPEThe default media type is "text/html; charset=UTF-8".
- 
DEFAULT_BUFFER_LIMITThe default buffer limit before bailing on trying to setContent-Length. The default is "65536".- See Also:
 
 
- 
- 
Method Details- 
render
- 
createOutputdefault Output.CloseableEncodedOutput<IOException> createOutput(Charset charset, jakarta.servlet.http.HttpServletResponse response) Creates the output from the servlet response to use for rendering.- Parameters:
- charset- charset resolved from- getMediaType()
- response- servlet response
- Returns:
- output that should be closed when finished
 
- 
jstachioReturns the jstachio singleton by default.- Returns:
- stachio singleton by default.
- See Also:
 
- 
modelThe model to be rendered byjstachio().- Returns:
- model defaulting to thisinstance.
 
- 
getContentType- Specified by:
- getContentTypein interface- View
 
- 
getMediaTypeThe media type for this view. The default is "text/html; charset=UTF-8".- Returns:
- the media type
 
- 
ofCreates a spring view from a model with content type: "text/html; charset=UTF-8".- Parameters:
- model- an instance of a class annotated with- JStache.
- Returns:
- view ready for rendering
 
- 
ofCreates a spring view from a model.- Parameters:
- model- an instance of a class annotated with- JStache.
- contentType- See- getContentType()
- Returns:
- view ready for rendering
 
- 
ofCreates a spring view from a model.- Parameters:
- model- an instance of a class annotated with- JStache.
- mediaType- the mediaType
- Returns:
- view ready for rendering
 
- 
ofCreates a spring view from a model.- Parameters:
- model- an instance of a class annotated with- JStache.
- mediaType- the mediaType
- jstachio- jstachio to use.
- Returns:
- view ready for rendering
 
 
-