Class HttpHeader
java.lang.Object
org.sblim.cimclient.internal.http.HttpHeader
Class HttpHeader represents a http header block
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class HeaderEntry represents a single header field -
Constructor Summary
ConstructorsConstructorDescriptionCtor.HttpHeader
(InputStream pReader) Ctor.HttpHeader
(InputStream pReader, long pTimeout) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a header field for client output (this means duplicate header entries are replaced)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)void
clear()
Clears all header fieldsstatic String
encode
(byte[] pData) Encodes raw datastatic String
Encodes raw data for a given character setstatic String
Encodes a given string for a given character setvoid
Throws a TrailerException if it contains recognized CIM errors in http trailer entries.void
examineTrailer
(String pOrigin) Throws a TrailerException if it contains recognized CIM errors in http trailer entries.Returns a field from the headeriterator()
Return an iterator over the header fieldsstatic HttpHeader
Parses a line from a header blockvoid
removeField
(String pName) Removes a field from the headertoString()
void
write
(ASCIIPrintStream pWriter) Writes a header block to a stream
-
Constructor Details
-
HttpHeader
public HttpHeader()Ctor. -
HttpHeader
Ctor. Parses the header from an input stream- Parameters:
pReader
- The input stream- Throws:
IOException
-
HttpHeader
Ctor. Parses the header from an input stream- Parameters:
pReader
- The input streampTimeout
- Maximum allowable time to read header- Throws:
IOException
-
-
Method Details
-
addField
Adds a header field for client output (this means duplicate header entries are replaced)- Parameters:
pName
- The name of the header fieldpValue
- The value
-
addParsedField
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 fieldpValue
- The value
-
clear
public void clear()Clears all header fields -
iterator
Return an iterator over the header fields- Returns:
- The iterator
-
parse
Parses a line from a header block- Parameters:
pLine
- The line- Returns:
- The http header
-
toString
-
removeField
Removes a field from the header- Parameters:
pName
- The name of the field
-
getField
Returns a field from the header- Parameters:
pName
- The name of the field- Returns:
- The value
-
write
Writes a header block to a stream- Parameters:
pWriter
- The stream
-
encode
Encodes raw data- Parameters:
pData
- The raw data- Returns:
- The encoded data
-
encode
Encodes raw data for a given character set- Parameters:
pData
- The raw datapEnc
- 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 stringpSourceEnc
- The source character setpTargetEnc
- The target character set- Returns:
- The encoded string
- Throws:
UnsupportedEncodingException
-
examineTrailer
Throws a TrailerException if it contains recognized CIM errors in http trailer entries.- Throws:
TrailerException
-
examineTrailer
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
-