Class JStachioHttpMessageConverter

java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<Object>
io.jstach.opt.spring.web.JStachioHttpMessageConverter
All Implemented Interfaces:
HttpMessageConverter<Object>
Direct Known Subclasses:
ServletJStachioHttpMessageConverter

Type-safe way to use JStachio in Spring Web.

For this to work the controllers need to return JStache models and have the controller method return annotated with ResponseBody.

Example:


 @JStache
 public record HelloModel(String message){}

 @GetMapping(value = "/")
 @ResponseBody
 public HelloModel hello() {
     return new HelloModel("Spring Boot is now JStachioed!");
 }
  
Because JStachio by default pre-encodes the static text parts of the template the output strategy handles the buffering instead of the framework (usually servlet) to improve performance and to reliable set Content-Length. This can be changed by overriding createOutput(HttpOutputMessage).
Author:
agentgt