Class AbstractHttpData

java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.handler.codec.http.multipart.AbstractHttpData
All Implemented Interfaces:
ByteBufHolder, HttpData, InterfaceHttpData, ReferenceCounted, Comparable<InterfaceHttpData>
Direct Known Subclasses:
AbstractDiskHttpData, AbstractMemoryHttpData

public abstract class AbstractHttpData extends AbstractReferenceCounted implements HttpData
Abstract HttpData implementation
  • Field Details

    • STRIP_PATTERN

      private static final Pattern STRIP_PATTERN
    • REPLACE_PATTERN

      private static final Pattern REPLACE_PATTERN
    • name

      private final String name
    • definedSize

      protected long definedSize
    • size

      protected long size
    • charset

      private Charset charset
    • completed

      private boolean completed
    • maxSize

      private long maxSize
  • Constructor Details

    • AbstractHttpData

      protected AbstractHttpData(String name, Charset charset, long size)
  • Method Details

    • getMaxSize

      public long getMaxSize()
      Description copied from interface: HttpData
      Returns the maxSize for this HttpData.
      Specified by:
      getMaxSize in interface HttpData
    • setMaxSize

      public void setMaxSize(long maxSize)
      Description copied from interface: HttpData
      Set the maxSize for this HttpData. When limit will be reached, an exception will be raised. Setting it to (-1) means no limitation. By default, to be set from the HttpDataFactory.
      Specified by:
      setMaxSize in interface HttpData
    • checkSize

      public void checkSize(long newSize) throws IOException
      Description copied from interface: HttpData
      Check if the new size is not reaching the max limit allowed. The limit is always computed in terms of bytes.
      Specified by:
      checkSize in interface HttpData
      Throws:
      IOException
    • getName

      public String getName()
      Description copied from interface: InterfaceHttpData
      Returns the name of this InterfaceHttpData.
      Specified by:
      getName in interface InterfaceHttpData
    • isCompleted

      public boolean isCompleted()
      Specified by:
      isCompleted in interface HttpData
      Returns:
      True if the InterfaceHttpData is completed (all data are stored)
    • setCompleted

      protected void setCompleted()
    • setCompleted

      protected void setCompleted(boolean completed)
    • getCharset

      public Charset getCharset()
      Description copied from interface: HttpData
      Returns the Charset passed by the browser or null if not defined.
      Specified by:
      getCharset in interface HttpData
      Returns:
      the Charset passed by the browser or null if not defined.
    • setCharset

      public void setCharset(Charset charset)
      Description copied from interface: HttpData
      Set the Charset passed by the browser if defined
      Specified by:
      setCharset in interface HttpData
      Parameters:
      charset - Charset to set - must be not null
    • length

      public long length()
      Description copied from interface: HttpData
      Returns the size in byte of the InterfaceHttpData
      Specified by:
      length in interface HttpData
      Returns:
      the size of the InterfaceHttpData
    • definedLength

      public long definedLength()
      Description copied from interface: HttpData
      Returns the defined length of the HttpData. If no Content-Length is provided in the request, the defined length is always 0 (whatever during decoding or in final state). If Content-Length is provided in the request, this is this given defined length. This value does not change, whatever during decoding or in the final state. This method could be used for instance to know the amount of bytes transmitted for one particular HttpData, for example one FileUpload or any known big Attribute.
      Specified by:
      definedLength in interface HttpData
      Returns:
      the defined length of the HttpData
    • content

      public ByteBuf content()
      Description copied from interface: ByteBufHolder
      Return the data which is held by this ByteBufHolder.
      Specified by:
      content in interface ByteBufHolder
    • deallocate

      protected void deallocate()
      Description copied from class: AbstractReferenceCounted
      Called once AbstractReferenceCounted.refCnt() is equals 0.
      Specified by:
      deallocate in class AbstractReferenceCounted
    • retain

      public HttpData retain()
      Description copied from interface: ReferenceCounted
      Increases the reference count by 1.
      Specified by:
      retain in interface ByteBufHolder
      Specified by:
      retain in interface HttpData
      Specified by:
      retain in interface InterfaceHttpData
      Specified by:
      retain in interface ReferenceCounted
      Overrides:
      retain in class AbstractReferenceCounted
    • retain

      public HttpData retain(int increment)
      Description copied from interface: ReferenceCounted
      Increases the reference count by the specified increment.
      Specified by:
      retain in interface ByteBufHolder
      Specified by:
      retain in interface HttpData
      Specified by:
      retain in interface InterfaceHttpData
      Specified by:
      retain in interface ReferenceCounted
      Overrides:
      retain in class AbstractReferenceCounted
    • touch

      public abstract HttpData touch()
      Description copied from interface: ReferenceCounted
      Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).
      Specified by:
      touch in interface ByteBufHolder
      Specified by:
      touch in interface HttpData
      Specified by:
      touch in interface InterfaceHttpData
      Specified by:
      touch in interface ReferenceCounted
      Overrides:
      touch in class AbstractReferenceCounted
    • touch

      public abstract HttpData touch(Object hint)
      Description copied from interface: ReferenceCounted
      Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.
      Specified by:
      touch in interface ByteBufHolder
      Specified by:
      touch in interface HttpData
      Specified by:
      touch in interface InterfaceHttpData
      Specified by:
      touch in interface ReferenceCounted