com.radekzitek.userver.http
Class HttpHeader

java.lang.Object
  extended bycom.radekzitek.userver.http.HttpHeader
All Implemented Interfaces:
HttpObject

public class HttpHeader
extends java.lang.Object
implements HttpObject

Author:
rzitek

Field Summary
(package private)  java.lang.String fieldName
          Header field name.
(package private)  java.lang.String fieldValue
          Header field value.
private static org.apache.log4j.Logger LOG
          Log4j logger.
 
Constructor Summary
HttpHeader()
          Default constuctor, creates empty header.
HttpHeader(java.lang.String headerLine)
          Constructs a header from the single string.
HttpHeader(java.lang.String fieldName, java.lang.String fieldValue)
          Constructs a header from field name and value provided as individual string.
 
Method Summary
 void clear()
          Empties the header.
 java.lang.String getFieldName()
          Returns the header field name.
 java.lang.String getFieldValue()
          Returns the header field value.
 void parse(java.lang.String headerLine)
          Parses given string into the object.
 void setFieldName(java.lang.String fieldName)
          Sets the header field name.
 void setFieldValue(java.lang.String fieldValue)
          Sets the header field value.
 java.lang.String toString()
          Returns string representation of the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG
Log4j logger.


fieldName

java.lang.String fieldName
Header field name.


fieldValue

java.lang.String fieldValue
Header field value.

Constructor Detail

HttpHeader

public HttpHeader()
Default constuctor, creates empty header.


HttpHeader

public HttpHeader(java.lang.String headerLine)
           throws HttpHeaderFormatException
Constructs a header from the single string. The format of the string is fieldName:fieldValue.

Parameters:
headerLine - the input string
Throws:
HttpHeaderFormatException - Exception is thrown if the : is not found in the input string or if the fieldName portion of the input string is empty.

HttpHeader

public HttpHeader(java.lang.String fieldName,
                  java.lang.String fieldValue)
Constructs a header from field name and value provided as individual string.

Parameters:
fieldName - the field name of the header
fieldValue - the field value of the header
Method Detail

parse

public void parse(java.lang.String headerLine)
           throws HttpHeaderFormatException
Description copied from interface: HttpObject
Parses given string into the object.

Specified by:
parse in interface HttpObject
Parameters:
headerLine - input string
Throws:
HttpHeaderFormatException

clear

public void clear()
Empties the header.

Specified by:
clear in interface HttpObject

getFieldName

public java.lang.String getFieldName()
Returns the header field name.

Returns:
the header field name

getFieldValue

public java.lang.String getFieldValue()
Returns the header field value.

Returns:
the header field value

setFieldName

public void setFieldName(java.lang.String fieldName)
Sets the header field name.

Parameters:
fieldName - field name to set

setFieldValue

public void setFieldValue(java.lang.String fieldValue)
Sets the header field value.

Parameters:
fieldValue - the heade field value to set

toString

public java.lang.String toString()
Returns string representation of the header.

Specified by:
toString in interface HttpObject
Returns:
Header as a string.