Class HttpHeader

java.lang.Object
org.sblim.cimclient.internal.http.HttpHeader

public class HttpHeader extends Object
Class HttpHeader represents a http header block
  • Constructor Details

    • HttpHeader

      public HttpHeader()
      Ctor.
    • HttpHeader

      public HttpHeader(InputStream pReader) throws IOException
      Ctor. Parses the header from an input stream
      Parameters:
      pReader - The input stream
      Throws:
      IOException
    • HttpHeader

      public HttpHeader(InputStream pReader, long pTimeout) throws IOException
      Ctor. Parses the header from an input stream
      Parameters:
      pReader - The input stream
      pTimeout - Maximum allowable time to read header
      Throws:
      IOException
  • Method Details

    • addField

      public void addField(String pName, String pValue)
      Adds a header field for client output (this means duplicate header entries are replaced)
      Parameters:
      pName - The name of the header field
      pValue - The value
    • addParsedField

      public void addParsedField(String pName, String pValue)
      Adds a header field from parsed server input (this means duplicate header entries are appended in comma-separated list as defined by RFC 2616)
      Parameters:
      pName - The name of the header field
      pValue - The value
    • clear

      public void clear()
      Clears all header fields
    • iterator

      Return an iterator over the header fields
      Returns:
      The iterator
    • parse

      public static HttpHeader parse(String pLine)
      Parses a line from a header block
      Parameters:
      pLine - The line
      Returns:
      The http header
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • removeField

      public void removeField(String pName)
      Removes a field from the header
      Parameters:
      pName - The name of the field
    • getField

      public String getField(String pName)
      Returns a field from the header
      Parameters:
      pName - The name of the field
      Returns:
      The value
    • write

      public void write(ASCIIPrintStream pWriter)
      Writes a header block to a stream
      Parameters:
      pWriter - The stream
    • encode

      public static String encode(byte[] pData)
      Encodes raw data
      Parameters:
      pData - The raw data
      Returns:
      The encoded data
    • encode

      public static String encode(byte[] pData, String pEnc) throws UnsupportedEncodingException
      Encodes raw data for a given character set
      Parameters:
      pData - The raw data
      pEnc - The character set
      Returns:
      The encoded data
      Throws:
      UnsupportedEncodingException
    • encode

      public static String encode(String pData, String pSourceEnc, String pTargetEnc) throws UnsupportedEncodingException
      Encodes a given string for a given character set
      Parameters:
      pData - The source string
      pSourceEnc - The source character set
      pTargetEnc - The target character set
      Returns:
      The encoded string
      Throws:
      UnsupportedEncodingException
    • examineTrailer

      public void examineTrailer() throws TrailerException
      Throws a TrailerException if it contains recognized CIM errors in http trailer entries.
      Throws:
      TrailerException
    • examineTrailer

      public void examineTrailer(String pOrigin) throws TrailerException
      Throws a TrailerException if it contains recognized CIM errors in http trailer entries.
      Parameters:
      pOrigin - The origin of the trailer (response, request, etc.)
      Throws:
      TrailerException