Class HttpByteBuf

java.lang.Object
net.mcbrawls.inject.http.HttpByteBuf

public class HttpByteBuf extends Object
A custom ByteBuf used for sending HTTP responses using HttpInterceptor.
  • Constructor Details

    • HttpByteBuf

      public HttpByteBuf(io.netty.buffer.ByteBuf inner)
  • Method Details

    • writeStatusLine

      public void writeStatusLine(String protocolVersion, int statusCode, String statusMessage)
      Writes the status line to the buffer. Format is as following: HTTP/{protocolVersion} {statusCode} {statusMessage} \n
    • writeHeader

      public void writeHeader(String header, String value)
      Writes an HTTP header to the buffer.
    • writeText

      public void writeText(String text)
      Writes text to the buffer.
    • writeBytes

      public void writeBytes(byte[] bytes)
      Writes a byte array to the buffer.
    • inner

      public io.netty.buffer.ByteBuf inner()
      Returns:
      the inner byte buf
    • httpBuf

      public static HttpByteBuf httpBuf(io.netty.channel.ChannelHandlerContext ctx)
      Creates a new HttpByteBuf based off a ChannelHandlerContext's allocator.
      Parameters:
      ctx - the context
      Returns:
      the HTTP byte buf