|
|||||||||
| Home >> All >> com >> sonalb >> net >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.sonalb.net.http
Class Header

java.lang.Objectjava.util.AbstractCollection
com.sonalb.net.http.Header
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.lang.Iterable, java.io.Serializable
- public class Header
- extends java.util.AbstractCollection
- implements java.io.Serializable, java.lang.Cloneable
- extends java.util.AbstractCollection
Represents the Header of an HTTP Message. An HTTP header usually consists of two major components:
- The first line containing HTTP-Command, HTTP-Version etc.
- A number of name-value pairs
NULL name fields in a pair are not permitted.
| Field Summary | |
static java.lang.String |
CVSID
|
private java.util.Vector |
theHeader
|
private java.lang.String |
topLine
|
| Constructor Summary | |
Header()
Creates an empty Header. |
|
Header(java.util.Collection c)
Creates a Header, and populates it with HeaderEntries from input Collection. |
|
Header(java.lang.String topLine,
java.util.Collection c)
Creates a Header with given top-line, and populates it with HeaderEntries from input Collection. |
|
| Method Summary | |
boolean |
add(java.lang.Object entry)
Add an object to the collection (optional operation). |
boolean |
add(java.lang.String key,
java.lang.String value)
Adds the specified key-value pair to this Header. |
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
boolean |
containsKey(java.lang.String s)
Checks whether any header entry exists with given key. |
boolean |
containsValue(java.lang.String s)
Checks whether any header entry exists with given value. |
Header |
getEntriesForKey(java.lang.String s)
Returns a Header consisting of all HeaderEntries having given key. |
Header |
getEntriesForValue(java.lang.String s)
Returns a Header consisting of all HeaderEntries having given value. |
HeaderEntry |
getEntryAt(int index)
Returns the entry at specified index. |
HeaderEntry |
getEntryForKey(java.lang.String s,
int j)
Returns the HeaderEntry corresponding to the first occurrence of the given key, after specified index (non-inclusive). |
HeaderEntry |
getEntryForValue(java.lang.String s,
int j)
Returns the HeaderEntry corresponding to the first occurrence of the given value, after specified index (non-inclusive). |
HeaderEntry |
getFirstEntryForKey(java.lang.String s)
Returns the HeaderEntry corresponding to the first occurrence of the given key. |
HeaderEntry |
getFirstEntryForValue(java.lang.String s)
Returns the HeaderEntry corresponding to the first occurrence of the given value. |
java.lang.String |
getHeaderField(int i)
Returns the header value for entry at specified index. |
java.lang.String |
getHeaderFieldKey(int i)
Returns the header key for entry at specified index. |
java.lang.String |
getTopLine()
Gets the top-line of this Header. |
boolean |
isEmpty()
Test whether this collection is empty. |
java.util.Iterator |
iterator()
Return an Iterator over this collection. |
void |
setTopLine(java.lang.String topLine)
Sets the top-line of this Header. |
int |
size()
Return the number of elements in this collection. |
java.lang.String |
toString()
Creates a String representation of the Collection. |
| Methods inherited from class java.util.AbstractCollection |
addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
equals, hashCode |
| Field Detail |
CVSID
public static final java.lang.String CVSID
- See Also:
- Constant Field Values
topLine
private java.lang.String topLine
theHeader
private java.util.Vector theHeader
| Constructor Detail |
Header
public Header()
- Creates an empty Header.
Header
public Header(java.util.Collection c)
- Creates a Header, and populates it with HeaderEntries from input Collection.
Header
public Header(java.lang.String topLine, java.util.Collection c)
- Creates a Header with given top-line, and populates it with HeaderEntries from input Collection.
| Method Detail |
setTopLine
public void setTopLine(java.lang.String topLine)
- Sets the top-line of this Header.
getTopLine
public java.lang.String getTopLine()
- Gets the top-line of this Header.
add
public boolean add(java.lang.String key, java.lang.String value)
- Adds the specified key-value pair to this Header.
getEntryAt
public HeaderEntry getEntryAt(int index)
- Returns the entry at specified index.
getHeaderFieldKey
public java.lang.String getHeaderFieldKey(int i)
- Returns the header key for entry at specified index.
getHeaderField
public java.lang.String getHeaderField(int i)
- Returns the header value for entry at specified index.
containsKey
public boolean containsKey(java.lang.String s)
- Checks whether any header entry exists with given key.
containsValue
public boolean containsValue(java.lang.String s)
- Checks whether any header entry exists with given value.
getFirstEntryForKey
public HeaderEntry getFirstEntryForKey(java.lang.String s)
- Returns the HeaderEntry corresponding to the first occurrence of the given key.
getFirstEntryForValue
public HeaderEntry getFirstEntryForValue(java.lang.String s)
- Returns the HeaderEntry corresponding to the first occurrence of the given value.
getEntryForKey
public HeaderEntry getEntryForKey(java.lang.String s, int j)
- Returns the HeaderEntry corresponding to the first occurrence of the given key, after specified index (non-inclusive).
getEntryForValue
public HeaderEntry getEntryForValue(java.lang.String s, int j)
- Returns the HeaderEntry corresponding to the first occurrence of the given value, after specified index (non-inclusive).
getEntriesForKey
public Header getEntriesForKey(java.lang.String s)
- Returns a Header consisting of all HeaderEntries having given key.
getEntriesForValue
public Header getEntriesForValue(java.lang.String s)
- Returns a Header consisting of all HeaderEntries having given value.
add
public boolean add(java.lang.Object entry)
- Description copied from class:
java.util.AbstractCollection - Add an object to the collection (optional operation). This implementation
always throws an UnsupportedOperationException - it should be
overridden if the collection is to be modifiable. If the collection
does not accept duplicates, simply return false. Collections may specify
limitations on what may be added.
- Specified by:
addin interfacejava.util.Collection
iterator
public java.util.Iterator iterator()
- Description copied from class:
java.util.AbstractCollection - Return an Iterator over this collection. The iterator must provide the
hasNext and next methods and should in addition provide remove if the
collection is modifiable.
- Specified by:
iteratorin interfacejava.util.Collection
size
public int size()
- Description copied from class:
java.util.AbstractCollection - Return the number of elements in this collection. If there are more than
Integer.MAX_VALUE elements, return Integer.MAX_VALUE.
- Specified by:
sizein interfacejava.util.Collection
toString
public java.lang.String toString()
- Description copied from class:
java.util.AbstractCollection - Creates a String representation of the Collection. The string returned is
of the form "[a, b, ...]" where a and b etc are the results of calling
toString on the elements of the collection. This implementation obtains an
Iterator over the Collection and adds each element to a StringBuffer as it
is returned by the iterator. "
" is inserted when the collection contains itself (only works for direct containment, not for collections inside collections).
isEmpty
public boolean isEmpty()
- Description copied from class:
java.util.AbstractCollection - Test whether this collection is empty. This implementation returns
size() == 0.
- Specified by:
isEmptyin interfacejava.util.Collection
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
|
|||||||||
| Home >> All >> com >> sonalb >> net >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC