|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flat502.rox.http.HttpMessageBuffer
com.flat502.rox.http.HttpRequestBuffer
public class HttpRequestBuffer
This class represents a buffer built up from one or more network messages, and containing an HTTP request.
| Constructor Summary | |
|---|---|
HttpRequestBuffer(HttpRpcServer server,
java.net.Socket socket)
|
|
HttpRequestBuffer(HttpRpcServer server,
java.net.Socket socket,
EncodingMap encodingMap)
Construct a new buffer for requests on the given socket. |
|
| Method Summary | |
|---|---|
java.util.Map |
getAcceptedEncodings()
Return a list of acceptable encodings (as specified by the client). |
Encoding |
getContentEncoding()
|
java.io.InputStream |
getContentStream()
|
double |
getHttpVersion()
|
java.lang.String |
getHttpVersionString()
|
java.lang.String |
getMethod()
|
java.lang.String |
getURI()
|
boolean |
isComplete()
Test if this buffer contains a complete HTTP message. |
java.lang.String |
toString()
|
protected void |
unpackPreamble(java.lang.String line)
|
protected void |
validateHeaders()
|
| Methods inherited from class com.flat502.rox.http.HttpMessageBuffer |
|---|
addBytes, getContent, getContentCharset, getContentReader, getContentType, getHeaders, getHeaderValue, getOrigin, getSocket, normalizeHeaderName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HttpRequestBuffer(HttpRpcServer server,
java.net.Socket socket)
public HttpRequestBuffer(HttpRpcServer server,
java.net.Socket socket,
EncodingMap encodingMap)
server - socket - The socket from which data for this buffer will be
gathered.encodingMap - An EncodingMap for mapping Content-Encoding
header values to an appropriate Encoding. May be
null.| Method Detail |
|---|
public java.lang.String getMethod()
public java.lang.String getURI()
public boolean isComplete()
throws java.lang.Exception
HttpMessageBufferRoughly speaking this test consists of three steps, ordered as follows:
Content-Length header is present.Content-Length header value and the
content of the HTTP message are equal.
isComplete in class HttpMessageBuffertrue if this buffer holds a complete HTTP message,
otherwise false.
java.lang.Exception - if a problem occurs applying any of the tests mention above.public java.util.Map getAcceptedEncodings()
The Accept-Content header is interpreted
as per
section 14.3
of RFC 2616 are stripped off and excluded from the
return values.
The returned map uses String keys specifying the encoding names
(converted to lowercase) and Float values specifying the qvalue.
If no qvalue was specified
a null value is used (which should be interpreted as
an implicit value "1.0"). If duplicate encodings are specified
the highest q-value will be retained. An unspecified q-value
is treated as having a higher value than an explicit value of "1.0".
An empty Accept-Content header will return
an empty map.
Iterating over the key-set of the map returned is guaranteed to return the encodings ordered in descending order of qvalue. Ties (i.e. equal qvalues) are broken by sorted so the first to appear in the header value appears first.
The map instance returned is unmodifiable.
null if no Accept-Encoding header
was present, or a map of accepted encodings.public Encoding getContentEncoding()
public java.io.InputStream getContentStream()
throws java.io.IOException
getContentStream in class HttpMessageBufferjava.io.IOExceptionpublic java.lang.String toString()
toString in class HttpMessageBuffer
protected void unpackPreamble(java.lang.String line)
throws HttpResponseException
unpackPreamble in class HttpMessageBufferHttpResponseExceptionpublic double getHttpVersion()
getHttpVersion in class HttpMessageBufferpublic java.lang.String getHttpVersionString()
getHttpVersionString in class HttpMessageBuffer
protected void validateHeaders()
throws HttpBufferException
validateHeaders in class HttpMessageBufferHttpBufferException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||