Vordel SDK

com.vordel.mime
Class HeaderSet

java.lang.Object
  extended by com.vordel.mime.HeaderSet
All Implemented Interfaces:
com.vordel.common.Dictionary, Headers

public class HeaderSet
extends java.lang.Object
implements Headers, com.vordel.common.Dictionary

Represents a set of MIME headers, normally associated with a MIME Body.

Note that in HTTP, not all headers are Body headers. "Connection-" headers, for example should not be included in a HeaderSet associated with a Body.

The "Content-Length" header is also a special case: because its value changes with the state of the body, it is unsafe to include here.


Nested Class Summary
static class HeaderSet.Header
          Represents a single header in a header set.
static class HeaderSet.HeaderEntry
           
 
Nested classes/interfaces inherited from interface com.vordel.common.Dictionary
com.vordel.common.Dictionary.MapAs
 
Field Summary
 
Fields inherited from interface com.vordel.common.Dictionary
empty
 
Constructor Summary
HeaderSet()
           
HeaderSet(HeaderSet headers)
           
 
Method Summary
 void addHeader(java.lang.String name, java.lang.Object o)
          Adds a header with the given value.
 void addHeader(java.lang.String name, java.lang.String o)
          Adds a header with the given value.
 boolean containsKey(java.lang.String key)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,HeaderSet.HeaderEntry>> entrySet()
           
 java.lang.Object get(java.lang.String key)
           
 java.lang.String getHeader(java.lang.String name)
          Returns the value of the specified request header as a String Returns a String containing the value of the requested header, or null if the request does not have a header of that name
 HeaderSet.HeaderEntry getHeaderEntry(java.lang.String name)
           
 java.util.Iterator<java.lang.String> getHeaderNames()
          Returns an enumeration of all the header names this request contains.
 java.util.Iterator<java.lang.String> getHeaders(java.lang.String name)
          Returns all the values of the specified request header as an Enumeration of String objects.
 int getHeadersLength()
           
 int getHeadersSize(java.lang.String name)
           
 java.util.Iterator<java.lang.String> getNames()
           
 java.lang.Object getParsed(HeaderParser p)
           
 java.lang.Object getParsed(HeaderParser p, java.lang.String headerName)
           
 boolean hasHeader(java.lang.String s)
           
 void parseMIME(java.io.InputStream is)
           
 void remove(java.lang.String s)
           
 void setHeader(java.lang.String name, java.lang.Object o)
          Set a header with the given value.
 void setHeader(java.lang.String name, java.lang.String o)
          Set a header with the given value.
 void setHeaderEntry(java.lang.String name, HeaderSet.HeaderEntry values)
           
 java.lang.String toString()
           
 void write(java.io.OutputStream os, int flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HeaderSet

public HeaderSet()

HeaderSet

public HeaderSet(HeaderSet headers)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setHeader

public void setHeader(java.lang.String name,
                      java.lang.Object o)
Set a header with the given value. If the header has already been set, the new value overwrites the previous one. The containsHeader method can be used to test the presence of a header before setting it's value

Parameters:
name - the header name
o - the parsed form of the header value

setHeaderEntry

public void setHeaderEntry(java.lang.String name,
                           HeaderSet.HeaderEntry values)

addHeader

public void addHeader(java.lang.String name,
                      java.lang.Object o)
Adds a header with the given value. This method allows headers to have multiple values

Parameters:
name - the header name
o - the parsed form of the header value

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String o)
Set a header with the given value. If the header has already been set, the new value overwrites the previous one. The containsHeader method can be used to test the presence of a header before setting it's value

Specified by:
setHeader in interface Headers
Parameters:
name - the header name
o - the parsed form of the header value

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String o)
Adds a header with the given value. This method allows headers to have multiple values

Specified by:
addHeader in interface Headers
Parameters:
name - the header name
o - the parsed form of the header value

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,HeaderSet.HeaderEntry>> entrySet()

getParsed

public java.lang.Object getParsed(HeaderParser p,
                                  java.lang.String headerName)

getParsed

public java.lang.Object getParsed(HeaderParser p)

getHeaders

public java.util.Iterator<java.lang.String> getHeaders(java.lang.String name)
Returns all the values of the specified request header as an Enumeration of String objects. Returns an Enumeration containing the values of the requested header. If the headerset does not have any headers of that name return an empty enumeration.

Specified by:
getHeaders in interface Headers

getHeadersSize

public int getHeadersSize(java.lang.String name)
Specified by:
getHeadersSize in interface Headers

getHeadersLength

public int getHeadersLength()
Returns:
The length (in bytes) of all the headers in the set, including the pairs

getHeaderNames

public java.util.Iterator<java.lang.String> getHeaderNames()
Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration.

Specified by:
getHeaderNames in interface Headers

getHeader

public java.lang.String getHeader(java.lang.String name)
Returns the value of the specified request header as a String Returns a String containing the value of the requested header, or null if the request does not have a header of that name


getHeaderEntry

public HeaderSet.HeaderEntry getHeaderEntry(java.lang.String name)

getNames

public java.util.Iterator<java.lang.String> getNames()

write

public void write(java.io.OutputStream os,
                  int flags)
           throws java.io.IOException
Throws:
java.io.IOException

remove

public void remove(java.lang.String s)

hasHeader

public boolean hasHeader(java.lang.String s)

get

public java.lang.Object get(java.lang.String key)
Specified by:
get in interface com.vordel.common.Dictionary

containsKey

public boolean containsKey(java.lang.String key)

parseMIME

public void parseMIME(java.io.InputStream is)
               throws java.io.IOException
Throws:
java.io.IOException

Vordel SDK


This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel