|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.http.GeneralHeader
public class GeneralHeader
A class to handle a general Header.
Nested Class Summary | |
---|---|
protected static class |
GeneralHeader.Header
This class holds a header value, that is a "type: some text" |
Field Summary | |
---|---|
static java.lang.String |
CRLF
The String consisting of \r and \n |
protected static java.util.Map<java.lang.String,java.lang.String> |
headerCache
A cache of strings to keep the different strings down. |
protected java.util.List<GeneralHeader.Header> |
headers
The headers of this Header in order. |
protected static boolean |
strictHTTP
If we should allow single \n to mean end of header |
Constructor Summary | |
---|---|
GeneralHeader()
Create a new HTTPHeader from scratch |
|
GeneralHeader(java.io.DataInputStream in)
Create a new HTTPHeader from scratch |
Method Summary | |
---|---|
void |
addHeader(java.lang.String type,
java.lang.String value)
Add a new header. |
void |
copyHeader(GeneralHeader to)
Copy all headers in this header to the given header. |
protected static java.lang.String |
getCachedString(java.lang.String s)
|
java.lang.String |
getHeader(java.lang.String type)
get the value of header type |
java.util.List<java.lang.String> |
getHeaders(java.lang.String type)
Get all headers of a specified type... |
void |
readExternal(java.io.ObjectInput in)
|
void |
readHeader(java.io.DataInputStream in)
Read in this header from the given Stream. |
void |
readHeader(java.io.DataInputStream in,
java.lang.String firstline)
Read in this header from the given Stream. |
static java.lang.String |
readLine(java.io.DataInputStream in)
|
void |
removeHeader(java.lang.String type)
removes a headerline from this header |
void |
removeValue(java.lang.String value)
removes a header with the specified value |
void |
setExistingValue(java.lang.String current,
java.lang.String newValue)
Set a specified header |
void |
setHeader(java.lang.String type,
java.lang.String value)
Set or replaces a value for given type. |
static void |
setStrictHTTP(boolean b)
Should headers be parsed with strict HTTP or not? |
java.lang.String |
toString()
Get the text value of this header |
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.List<GeneralHeader.Header> headers
public static final java.lang.String CRLF
protected static boolean strictHTTP
protected static java.util.Map<java.lang.String,java.lang.String> headerCache
Constructor Detail |
---|
public GeneralHeader()
public GeneralHeader(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public static void setStrictHTTP(boolean b)
protected static java.lang.String getCachedString(java.lang.String s)
public void readHeader(java.io.DataInputStream in) throws java.io.IOException
in
- the Stream to read the header from.
java.io.IOException
public static java.lang.String readLine(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
public void readHeader(java.io.DataInputStream in, java.lang.String firstline) throws java.io.IOException
in
- the Stream to read the header from.firstline
- the first line of this header.
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getHeader(java.lang.String type)
type
- the Header were intrested in.
public void setHeader(java.lang.String type, java.lang.String value)
type
- the type or category that we want to set.value
- the value we want to setpublic void setExistingValue(java.lang.String current, java.lang.String newValue)
current
- the type or category that we want to set.newValue
- the value we want to setpublic void addHeader(java.lang.String type, java.lang.String value)
type
- the type or category that we want to set.value
- the value we want to setpublic void removeHeader(java.lang.String type)
type
- the type we want to removepublic void removeValue(java.lang.String value)
value
- the value of the header we want to removepublic java.util.List<java.lang.String> getHeaders(java.lang.String type)
type
- the type of the headers to get, eg. "Cache-Control".public void copyHeader(GeneralHeader to)
to
- the GeneralHeader to add headers to.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |