Class JStachioMessageBodyWriter<T>

java.lang.Object
io.micronaut.views.jstachio.JStachioMessageBodyWriter<T>
Type Parameters:
T - type to be encoded
All Implemented Interfaces:
io.micronaut.http.body.MessageBodyWriter<T>

@Singleton @Produces("text/html") public class JStachioMessageBodyWriter<T> extends Object implements io.micronaut.http.body.MessageBodyWriter<T>
A message body writer for JStachio JStache annotated models. If the JStachio supports the body type it writes the template. If the HTTP Header Content-Type is not present, it adds it to the response HTTP Headers with the value text/html.
Since:
4.1.0
Author:
agentgt
  • Constructor Summary

    Constructors
    Constructor
    Description
    JStachioMessageBodyWriter(io.jstach.jstachio.JStachio jstachio)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isWriteable(@NonNull io.micronaut.core.type.Argument<T> type, @Nullable io.micronaut.http.MediaType mediaType)
     
    void
    writeTo(@NonNull io.micronaut.core.type.Argument<T> type, @NonNull io.micronaut.http.MediaType mediaType, T object, @NonNull io.micronaut.core.type.MutableHeaders outgoingHeaders, @NonNull OutputStream outputStream)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.http.body.MessageBodyWriter

    createSpecific, isBlocking, writeTo
  • Constructor Details

    • JStachioMessageBodyWriter

      public JStachioMessageBodyWriter(io.jstach.jstachio.JStachio jstachio)
      Parameters:
      jstachio - JStachio
  • Method Details

    • isWriteable

      public boolean isWriteable(@NonNull @NonNull io.micronaut.core.type.Argument<T> type, @Nullable @Nullable io.micronaut.http.MediaType mediaType)
      Specified by:
      isWriteable in interface io.micronaut.http.body.MessageBodyWriter<T>
    • writeTo

      public void writeTo(@NonNull @NonNull io.micronaut.core.type.Argument<T> type, @NonNull @NonNull io.micronaut.http.MediaType mediaType, T object, @NonNull @NonNull io.micronaut.core.type.MutableHeaders outgoingHeaders, @NonNull @NonNull OutputStream outputStream) throws io.micronaut.http.codec.CodecException
      Specified by:
      writeTo in interface io.micronaut.http.body.MessageBodyWriter<T>
      Throws:
      io.micronaut.http.codec.CodecException