Class 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.

    • Field Detail

      • LOG

        private static final Logger LOG
      • _encodedField

        private final byte[][] _encodedField
    • Constructor Detail

      • PreEncodedHttpField

        public PreEncodedHttpField​(HttpHeader header,
                                   java.lang.String name,
                                   java.lang.String value)
      • PreEncodedHttpField

        public PreEncodedHttpField​(HttpHeader header,
                                   java.lang.String value)
      • PreEncodedHttpField

        public PreEncodedHttpField​(java.lang.String name,
                                   java.lang.String value)
    • Method Detail

      • index

        private static int index​(HttpVersion version)
      • putTo

        public void putTo​(java.nio.ByteBuffer bufferInFillMode,
                          HttpVersion version)