com.monkeycoder.monkeynetwork
Class HttpHeaderData

java.lang.Object
  extended by com.monkeycoder.monkeynetwork.HttpHeaderData

public class HttpHeaderData
extends java.lang.Object

This class represents an HTTP response header. It parses and holds all values of the header in an easy to access container.

Author:
David Stephens

Constructor Summary
HttpHeaderData(java.lang.String inHeader)
          Creates an HttpHeaderData using the supplied raw response header.
 
Method Summary
 java.lang.String getHeaderValue(java.lang.String inKey)
          Gets the HTTP Header value for the specified key.
 java.util.ArrayList<java.lang.String> getHeaderValues(java.lang.String inKey)
          Gets all HTTP Header values for the specified key.
 int getHttpMajorVersion()
          Gets the HTTP Major version number.
 int getHttpMinorVersion()
          Gets the HTTP Minor version number.
 java.util.Set<java.lang.String> getKeys()
          Get a list of available keys from this HTTP Header.
 java.lang.String getRawHeader()
          Get the original raw HTTP Header.
 int getResponseCode()
          Gets the HTTP Response Code number.
 java.lang.String getResponseMessage()
          Gets the HTTP Response message.
 java.lang.String toString()
          Formats the entire parsed HTTP response header into a String for display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpHeaderData

public HttpHeaderData(java.lang.String inHeader)
Creates an HttpHeaderData using the supplied raw response header. This raw header is parsed for easy access.

Parameters:
inHeader - The raw string data of the response header.
Method Detail

getRawHeader

public java.lang.String getRawHeader()
Get the original raw HTTP Header.

Returns:
The original raw HTTP Header.

getKeys

public java.util.Set<java.lang.String> getKeys()
Get a list of available keys from this HTTP Header.

Returns:
A list of available keys from this HTTP Header.

getHeaderValue

public java.lang.String getHeaderValue(java.lang.String inKey)
Gets the HTTP Header value for the specified key. If there are multiple values for this key only the first is returned. If the key doesn't exist, null is returned.

Parameters:
inKey - The key for which the value will be returned.
Returns:
The first or only value associated with the specified key, or null if the key doesn't exist.

getHeaderValues

public java.util.ArrayList<java.lang.String> getHeaderValues(java.lang.String inKey)
Gets all HTTP Header values for the specified key. If the key doesn't exist, null is returned.

Parameters:
inKey - The key for which the values will be returned.
Returns:
All values associated with the specified key, or null if the key doesn't exist.

getHttpMajorVersion

public int getHttpMajorVersion()
Gets the HTTP Major version number.

Returns:
The HTTP Major version number.

getHttpMinorVersion

public int getHttpMinorVersion()
Gets the HTTP Minor version number.

Returns:
The HTTP Minor version number.

getResponseCode

public int getResponseCode()
Gets the HTTP Response Code number.

Returns:
The HTTP Response Code number.

getResponseMessage

public java.lang.String getResponseMessage()
Gets the HTTP Response message.

Returns:
The HTTP Response message.

toString

public java.lang.String toString()
Formats the entire parsed HTTP response header into a String for display.

Overrides:
toString in class java.lang.Object
Returns:
The parsed HTTP response header.