Class FlatHttpResponse

java.lang.Object
io.inverno.mod.http.base.internal.netty.FlatHttpResponse
All Implemented Interfaces:
io.netty.buffer.ByteBufHolder, io.netty.handler.codec.DecoderResultProvider, io.netty.handler.codec.http.HttpContent, io.netty.handler.codec.http.HttpMessage, io.netty.handler.codec.http.HttpObject, io.netty.handler.codec.http.HttpResponse, io.netty.util.ReferenceCounted
Direct Known Subclasses:
FlatFullHttpResponse

public class FlatHttpResponse extends Object implements io.netty.handler.codec.http.HttpResponse, io.netty.handler.codec.http.HttpContent

Optimized HttpResponse implementation.

Since:
1.0
Author:
Jeremy Kuhn
  • Field Details

    • version

      protected io.netty.handler.codec.http.HttpVersion version
    • status

      protected io.netty.handler.codec.http.HttpResponseStatus status
    • headers

      protected io.netty.handler.codec.http.HttpHeaders headers
    • content

      protected final io.netty.buffer.ByteBuf content
    • result

      protected io.netty.handler.codec.DecoderResult result
  • Constructor Details

    • FlatHttpResponse

      public FlatHttpResponse(io.netty.handler.codec.http.HttpVersion version, io.netty.handler.codec.http.HttpResponseStatus status, io.netty.handler.codec.http.HttpHeaders headers, boolean empty)

      Creates a flat HTTP response.

      Parameters:
      version - the HTTP version
      status - the HTTP response status
      headers - the HTTP headers
      empty - true to create an empty response, false otherwise
    • FlatHttpResponse

      public FlatHttpResponse(io.netty.handler.codec.http.HttpVersion version, io.netty.handler.codec.http.HttpResponseStatus status, io.netty.handler.codec.http.HttpHeaders headers, io.netty.buffer.ByteBuf content)

      Creates a flat HTTP response.

      Parameters:
      version - the HTTP version
      status - the HTTP response status
      headers - the HTTP headers
      content - the response content
  • Method Details

    • isEmpty

      public boolean isEmpty()

      Determines whether the reponse is empty.

      Returns:
      true if the response has no content, false otherwise
    • getProtocolVersion

      @Deprecated public io.netty.handler.codec.http.HttpVersion getProtocolVersion()
      Deprecated.
      Specified by:
      getProtocolVersion in interface io.netty.handler.codec.http.HttpMessage
    • protocolVersion

      public io.netty.handler.codec.http.HttpVersion protocolVersion()
      Specified by:
      protocolVersion in interface io.netty.handler.codec.http.HttpMessage
    • headers

      public io.netty.handler.codec.http.HttpHeaders headers()
      Specified by:
      headers in interface io.netty.handler.codec.http.HttpMessage
    • getDecoderResult

      @Deprecated public io.netty.handler.codec.DecoderResult getDecoderResult()
      Deprecated.
      Specified by:
      getDecoderResult in interface io.netty.handler.codec.http.HttpObject
    • decoderResult

      public io.netty.handler.codec.DecoderResult decoderResult()
      Specified by:
      decoderResult in interface io.netty.handler.codec.DecoderResultProvider
    • setDecoderResult

      public void setDecoderResult(io.netty.handler.codec.DecoderResult result)
      Specified by:
      setDecoderResult in interface io.netty.handler.codec.DecoderResultProvider
    • content

      public io.netty.buffer.ByteBuf content()
      Specified by:
      content in interface io.netty.buffer.ByteBufHolder
    • refCnt

      public int refCnt()
      Specified by:
      refCnt in interface io.netty.util.ReferenceCounted
    • release

      public boolean release()
      Specified by:
      release in interface io.netty.util.ReferenceCounted
    • release

      public boolean release(int decrement)
      Specified by:
      release in interface io.netty.util.ReferenceCounted
    • copy

      public FlatHttpResponse copy()
      Specified by:
      copy in interface io.netty.buffer.ByteBufHolder
      Specified by:
      copy in interface io.netty.handler.codec.http.HttpContent
    • duplicate

      public FlatHttpResponse duplicate()
      Specified by:
      duplicate in interface io.netty.buffer.ByteBufHolder
      Specified by:
      duplicate in interface io.netty.handler.codec.http.HttpContent
    • retainedDuplicate

      public FlatHttpResponse retainedDuplicate()
      Specified by:
      retainedDuplicate in interface io.netty.buffer.ByteBufHolder
      Specified by:
      retainedDuplicate in interface io.netty.handler.codec.http.HttpContent
    • replace

      public FlatHttpResponse replace(io.netty.buffer.ByteBuf content)
      Specified by:
      replace in interface io.netty.buffer.ByteBufHolder
      Specified by:
      replace in interface io.netty.handler.codec.http.HttpContent
    • retain

      public FlatHttpResponse retain()
      Specified by:
      retain in interface io.netty.buffer.ByteBufHolder
      Specified by:
      retain in interface io.netty.handler.codec.http.HttpContent
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
    • retain

      public FlatHttpResponse retain(int increment)
      Specified by:
      retain in interface io.netty.buffer.ByteBufHolder
      Specified by:
      retain in interface io.netty.handler.codec.http.HttpContent
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
    • touch

      public FlatHttpResponse touch()
      Specified by:
      touch in interface io.netty.buffer.ByteBufHolder
      Specified by:
      touch in interface io.netty.handler.codec.http.HttpContent
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
    • touch

      public FlatHttpResponse touch(Object hint)
      Specified by:
      touch in interface io.netty.buffer.ByteBufHolder
      Specified by:
      touch in interface io.netty.handler.codec.http.HttpContent
      Specified by:
      touch in interface io.netty.util.ReferenceCounted
    • getStatus

      @Deprecated public io.netty.handler.codec.http.HttpResponseStatus getStatus()
      Deprecated.
      Specified by:
      getStatus in interface io.netty.handler.codec.http.HttpResponse
    • status

      public io.netty.handler.codec.http.HttpResponseStatus status()
      Specified by:
      status in interface io.netty.handler.codec.http.HttpResponse
    • setStatus

      public FlatHttpResponse setStatus(io.netty.handler.codec.http.HttpResponseStatus status)
      Specified by:
      setStatus in interface io.netty.handler.codec.http.HttpResponse
    • setProtocolVersion

      public FlatHttpResponse setProtocolVersion(io.netty.handler.codec.http.HttpVersion version)
      Specified by:
      setProtocolVersion in interface io.netty.handler.codec.http.HttpMessage
      Specified by:
      setProtocolVersion in interface io.netty.handler.codec.http.HttpResponse