Class ChunkHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Object>
com.mastfrog.acteur.ChunkHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public abstract class ChunkHandler extends io.netty.channel.SimpleChannelInboundHandler<Object>
Subclasses of this can be used from the @Early annotation to provide an object that will process inbound HTTP chunks.
Author:
Tim Boudreau
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected final void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    protected abstract void
    onContent(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf chunk, io.netty.handler.codec.http.HttpHeaders trailersOrHeaders, boolean done)
    Called with each chunk of content as it arrives.
    protected final void
    resume(Object... ctx)
     
    void
     

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

    • ChunkHandler

      public ChunkHandler()
  • Method Details

    • setResumer

      public void setResumer(Deferral.Resumer resumer)
    • resume

      protected final void resume(Object... ctx)
    • channelRead0

      protected final void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<Object>
      Throws:
      Exception
    • acceptInboundMessage

      public boolean acceptInboundMessage(Object msg) throws Exception
      Overrides:
      acceptInboundMessage in class io.netty.channel.SimpleChannelInboundHandler<Object>
      Throws:
      Exception
    • onContent

      protected abstract void onContent(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf chunk, io.netty.handler.codec.http.HttpHeaders trailersOrHeaders, boolean done) throws Exception
      Called with each chunk of content as it arrives. Once the final content is processed and you want to send the response, call resume() with any objects you want to add for injection into susbsequent acteurs.
      Parameters:
      ctx - The context
      chunk - The chunk
      trailersOrHeaders - Trailers in the case of a LastHttpContent, headers in the case of a FullHttpRequest (non chunked)
      done - If this is the last one
      Throws:
      Exception - If something goes wrong