|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GenericHeader
This is a GenericHeader
object that can be used
to represent the headers that can be found in a HTTP message
header. This can be used to access the HTTP message headers
conveniently.
This does not include the request and status line of a request
or response. The GenericHeader
is used to represent
the set of headers of the form "Header-Name: header-value".
Method Summary | |
---|---|
void |
add(java.lang.String name,
int value)
This can be used to add a HTTP message header to this object. |
void |
add(java.lang.String name,
java.lang.String value)
This can be used to add a HTTP message header to this object. |
void |
addDate(java.lang.String name,
long date)
This is used as a convenience method for adding a header that needs to be parsed into a HTTP-date string. |
void |
clear()
This is used to clear all HTTP message headers from the message header. |
boolean |
contains(java.lang.String name)
This is used to see if there is a HTTP message header with the given name in this container. |
boolean |
contains(java.lang.String name,
java.lang.String value)
This is used to see if there is a HTTP message header with the given name in this container, if it exists this will check to see if the provided value exists. |
long |
getDate(int off)
This can be used to get the value of the HTTP message header at the specified index. |
long |
getDate(java.lang.String name)
This can be used to get the date of the first message header that has the specified name. |
java.lang.String |
getName(int off)
This is used to get the name value of the HTTP message header at the specified index. |
java.lang.String |
getValue(int off)
This is used to get the text value of the HTTP message header at the specified index. |
java.lang.String |
getValue(java.lang.String name)
This can be used to get the value of the first message header that has the specified name. |
java.lang.String[] |
getValues(java.lang.String name)
This can be used to get the values of HTTP message headers that have the specified name. |
int |
headerCount()
This can be used to determine how many HTTP message headers this object contains. |
int |
indexOf(java.lang.String name)
This can be used to find the first occurrence of the specified HTTP message header. |
int |
indexOf(java.lang.String name,
int from)
This can be used to find the first occurrence of the specified HTTP message header from a given index. |
void |
remove(int off)
This can be used to remove the HTTP message header at the specified index. |
void |
removeAll(java.lang.String name)
This can be used to remove all HTTP message headers with the specified name. |
void |
set(java.lang.String name,
int value)
This can be used to set a HTTP message header to this object. |
void |
set(java.lang.String name,
java.lang.String value)
This can be used to set a HTTP message header to this object. |
void |
setDate(java.lang.String name,
long date)
This is used as a convenience method for setting a header that needs to be parsed into a HTTP-date string. |
Method Detail |
---|
int headerCount()
headerCount
represents
the number of individual HTTP message headers that this has.
int indexOf(java.lang.String name)
name
- name of the HTTP message header being searched for
int indexOf(java.lang.String name, int from)
name
- name of the HTTP message header being searched forfrom
- the index from which the search will start
void add(java.lang.String name, java.lang.String value)
indexOf
in combination with the get methods.
name
- the name of the HTTP message header to be addedvalue
- the value the HTTP message header will havevoid set(java.lang.String name, java.lang.String value)
indexOf
in combination with the get methods.
This will perform a removeAll
using the issued
header name before the header value is set.
name
- the name of the HTTP message header to be addedvalue
- the value the HTTP message header will havevoid add(java.lang.String name, int value)
indexOf
in combination with the get methods.
name
- the name of the HTTP message header to be addedvalue
- the value the HTTP message header will havevoid set(java.lang.String name, int value)
indexOf
in combination with the get methods.
This will perform a removeAll
using the issued
header name before the header value is set.
name
- the name of the HTTP message header to be addedvalue
- the value the HTTP message header will havevoid addDate(java.lang.String name, long date)
name
- the name of the HTTP message header to be addeddate
- the value the HTTP message header will have when
parsed into RFC 1123 formatvoid setDate(java.lang.String name, long date)
removeAll
using the issued
header name before the header value is set.
name
- the name of the HTTP message header to be addeddate
- the value the HTTP message header will have when
parsed into RFC 1123 formatvoid remove(int off)
indexOf
method previous to this. If the
index specified is not valid then an
IndexOutOfBoundsException
may be thrown.
off
- index of the HTTP message header to be removedvoid removeAll(java.lang.String name)
name
- name of the message headers to be removedjava.lang.String getValue(int off)
off
- the offset of the HTTP message header value
java.lang.String getName(int off)
getValue(int)
method so that the contents of the
HTTP message header can be fully examined.
off
- the offset of the HTTP message header name value
long getDate(int off)
off
- the offset of the date HTTP message header value
java.lang.String getValue(java.lang.String name)
indexOf
methods. This returns null if theres
not a HTTP message header.
name
- the HTTP message header to get the value from
java.lang.String[] getValues(java.lang.String name)
substring
and trim
calls.
The tokens returned by this method are ordered according to there HTTP quality values, or "q" values, see RFC 2616 section 3.9. This also strips out the quality parameter from tokens returned. So "image/html; q=0.9" results in "image/html". If there are no "q" values present then order is by appearence.
The result from this is either the trimmed header value, that is, the header value with no leading or trailing whitespace or an array of trimmed tokens ordered with the most preferred in the lower indexes, so index 0 is has higest preference.
name
- the name of the headers that are to be retrieved
long getDate(java.lang.String name)
indexOf
methods. This returns -1 if theres not a
HTTP message header.
name
- the HTTP message header to get the value from
boolean contains(java.lang.String name)
name
- the HTTP message header to get the value from
boolean contains(java.lang.String name, java.lang.String value)
name
- the HTTP message header to get the value fromvalue
- this value to find within the HTTP value
void clear()
headerCount
is zero after this method is
invoked, this is a convenience method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |