org.jdesktop.http
Class Header

java.lang.Object
  extended by org.jdesktop.beans.AbstractBean
      extended by org.jdesktop.http.NameValuePair
          extended by org.jdesktop.http.Header
All Implemented Interfaces:
Cloneable

public class Header
extends NameValuePair

Represents a header field in an http Request or Response.


Nested Class Summary
static class Header.Element
          A representation of an Element within a Header.
 
Constructor Summary
Header()
          Creates a new Header with a null name and value, and no elements.
Header(String name, String value)
          Creates a new Header with the given name and value, and no elements.
Header(String name, String value, Header.Element... elements)
          Creates a new Header with the given name, value, and elements.
 
Method Summary
 Header.Element[] getElements()
          Returns an array of Elements for this Header.
 void setElements(Header.Element... elements)
          Sets the elements.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class org.jdesktop.http.NameValuePair
clone, getName, getValue, setName, setValue
 
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Header

public Header()
Creates a new Header with a null name and value, and no elements.


Header

public Header(String name,
              String value)
Creates a new Header with the given name and value, and no elements.

Parameters:
name - The name. May be null.
value - The value. May be null.

Header

public Header(String name,
              String value,
              Header.Element... elements)
Creates a new Header with the given name, value, and elements. If elements is null, then an empty set of elements will be used instead.

Parameters:
name - The name. May be null.
value - The value. May be null.
elements - The elements. May be null. If null, then getElements() will return an empty array, rather than null.
Method Detail

getElements

public Header.Element[] getElements()
Returns an array of Elements for this Header. This array returned will never be null. A new array instance will be returned for every invocation of this method.

Returns:
array of Elements. This will never be null.

setElements

public void setElements(Header.Element... elements)
Sets the elements. If the elements param is null, this will set the empty set of elements. That is, getElements() will return an empty array rather than null.

Parameters:
elements - The Elements. May be null. Replaces the old array of elements.

toString

public String toString()
Description copied from class: java.lang.Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class NameValuePair
Returns:
a string representation of the object.