Class PreEncodedHttpField

java.lang.Object
org.eclipse.jetty.http.HttpField
org.eclipse.jetty.http.PreEncodedHttpField

public class PreEncodedHttpField extends HttpField
Pre encoded HttpField.

An HttpField that will be cached and used many times can be created as a PreEncodedHttpField, which will use the HttpFieldPreEncoder instances discovered by the ServiceLoader to pre-encode the header for each version of HTTP in use. This will save garbage and CPU each time the field is encoded into a response.

  • Constructor Details

    • PreEncodedHttpField

      public PreEncodedHttpField(HttpHeader header, String name, String value)
    • PreEncodedHttpField

      public PreEncodedHttpField(HttpHeader header, String value)
    • PreEncodedHttpField

      public PreEncodedHttpField(HttpHeader header, long value)
    • PreEncodedHttpField

      public PreEncodedHttpField(String name, String value)
    • PreEncodedHttpField

      public PreEncodedHttpField(String name, long value)
  • Method Details

    • putTo

      public void putTo(ByteBuffer bufferInFillMode, HttpVersion version)
    • getEncodedLength

      public int getEncodedLength(HttpVersion version)
    • contains

      public boolean contains(String search)
      Description copied from class: HttpField
      Look for a value in a possible multivalued field
      Overrides:
      contains in class HttpField
      Parameters:
      search - Values to search for (case-insensitive)
      Returns:
      True iff the value is contained in the field value entirely or as an element of a quoted comma separated list. List element parameters (eg qualities) are ignored, except if they are q=0, in which case the item itself is ignored.
    • getIntValue

      public int getIntValue()
      Overrides:
      getIntValue in class HttpField
    • getLongValue

      public long getLongValue()
      Overrides:
      getLongValue in class HttpField