Class HttpHeader


  • public class HttpHeader
    extends Object
    A wrapper class for http header key-value pairs
    • Constructor Detail

      • HttpHeader

        public HttpHeader​(String name,
                          String value)
        Parameters:
        name - header name
        value - header value
      • HttpHeader

        public HttpHeader​(byte[] name,
                          byte[] value)
        Parameters:
        name - header name
        value - header value
    • Method Detail

      • getName

        public String getName()
        Returns:
        the name of the header, converted to a UTF-8 string
      • getNameBytes

        public byte[] getNameBytes()
        Returns:
        the name of the header, in raw bytes
      • getValue

        public String getValue()
        Returns:
        the value of the header, converted to a UTF-8 string
      • getValueBytes

        public byte[] getValueBytes()
        Returns:
        the value of the header, in raw bytes
      • loadHeadersListFromMarshalledHeadersBlob

        public static List<HttpHeader> loadHeadersListFromMarshalledHeadersBlob​(ByteBuffer headersBlob)
        Each header is marshalled as [4-bytes BE name length] [variable length name value] [4-bytes BE value length] [variable length value value]
        Parameters:
        headersBlob - Blob of encoded headers
        Returns:
        array of decoded headers
      • marshalHeadersForJni

        public static byte[] marshalHeadersForJni​(List<HttpHeader> headers)
        Lists of headers are marshalled as follows: each string field is: [4-bytes BE] [variable length bytes specified by the previous field]
        Parameters:
        headers - List of header name-value pairs
        Returns:
        encoded blob of headers