Class JsonContentProcessor

java.lang.Object
io.micronaut.http.server.netty.AbstractHttpContentProcessor
io.micronaut.http.server.netty.jackson.JsonContentProcessor
All Implemented Interfaces:
Toggleable, HttpContentProcessor

@Internal public final class JsonContentProcessor extends AbstractHttpContentProcessor
This class will handle subscribing to a JSON stream and binding once the events are complete in a non-blocking manner.
Since:
1.0
Author:
Graeme Rocher
  • Constructor Details

    • JsonContentProcessor

      public JsonContentProcessor(NettyHttpRequest<?> nettyHttpRequest, NettyHttpServerConfiguration configuration, JsonMapper jsonMapper)
      Parameters:
      nettyHttpRequest - The Netty Http request
      configuration - The Http server configuration
      jsonMapper - The json codec
  • Method Details

    • resultType

      public HttpContentProcessor resultType(Argument<?> type)
      Description copied from interface: HttpContentProcessor
      Set the type of the values returned by this processor. Most processors do not respect this setting, but e.g. the JsonContentProcessor does.
      Parameters:
      type - The type produced by this processor
      Returns:
      This processor, for chaining
    • processSingle

      public Object processSingle(io.netty.buffer.ByteBuf data) throws Throwable
      Description copied from interface: HttpContentProcessor
      Process a single ByteBuf into a single item, if possible.
      Parameters:
      data - The input data
      Returns:
      The output value, or null if this is unsupported.
      Throws:
      Throwable - Any failure
    • onData

      protected void onData(io.netty.buffer.ByteBufHolder message, Collection<Object> out) throws Throwable
      Description copied from class: AbstractHttpContentProcessor
      Called after verifying the data of the message.
      Specified by:
      onData in class AbstractHttpContentProcessor
      Parameters:
      message - The message
      out - The collection to add any produced messages to
      Throws:
      Throwable
    • complete

      public void complete(Collection<Object> out) throws Throwable
      Description copied from interface: HttpContentProcessor
      Finish processing data.
      Parameters:
      out - The collection to add remaining output items to
      Throws:
      Throwable