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 classClass HeaderEntry represents a single header field -
Constructor Summary
ConstructorsConstructorDescriptionCtor.HttpHeader(InputStream pReader) Ctor.HttpHeader(InputStream pReader, long pTimeout) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a header field for client output (this means duplicate header entries are replaced)voidaddParsedField(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)voidclear()Clears all header fieldsstatic Stringencode(byte[] pData) Encodes raw datastatic StringEncodes raw data for a given character setstatic StringEncodes a given string for a given character setvoidThrows a TrailerException if it contains recognized CIM errors in http trailer entries.voidexamineTrailer(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 HttpHeaderParses a line from a header blockvoidremoveField(String pName) Removes a field from the headertoString()voidwrite(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
-
addParsedField
-
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
-
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
-