public class HttpRequest extends HttpMessage
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpRequest.Method
Representation of the various HTTP methods.
|
HttpMessage.BodyEMPTY_BODY, NO_BODY| Constructor and Description |
|---|
HttpRequest(HttpRequest.Method method,
java.net.URI uri,
java.lang.String httpVersion) |
HttpRequest(HttpRequest.Method method,
java.net.URI uri,
java.lang.String httpVersion,
java.io.InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(java.lang.String name,
java.lang.String value)
Adds another parameter.
|
void |
addParameter(java.lang.String name,
java.lang.String[] values)
Adds a multi-value parameter.
|
java.lang.String |
getHttpVersion() |
HttpRequest.Method |
getMethod() |
java.lang.String[] |
getParameter(java.lang.String name) |
java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> |
getParameterList() |
java.net.URI |
getUri() |
static HttpRequest |
read(java.io.InputStream in)
Parses and returns one HTTP request from the given
InputStream. |
static void |
read(java.nio.channels.ReadableByteChannel in,
Multiplexer multiplexer,
ConsumerWhichThrows<HttpRequest,java.io.IOException> requestConsumer)
Reads one HTTP request from
in through the multiplexer and passes it to the requestConsumer. |
void |
setHttpVersion(java.lang.String httpVersion)
Changes the HTTP version of this request.
|
void |
setMethod(HttpRequest.Method method)
Changes the HTTP method of this request.
|
void |
setParameter(java.lang.String name,
java.lang.String value)
Removes all parameters with the given name and adds another parameter.
|
void |
setParameter(java.lang.String name,
java.lang.String[] values)
Removes all parameters with the given name and adds another multi-value parameter.
|
void |
setParameterList(java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> parameters)
Changes this HTTP request's parameters.
|
void |
setUri(java.net.URI uri)
Changes the URI of this HTTP request.
|
void |
write(java.io.OutputStream out)
Writes this HTTP request to the given
OutputStream. |
addHeader, addHeader, addHeader, addHeader, body, body, body, body, getCharset, getDateHeader, getHeader, getHeaders, getHeaders, getIntHeader, getLongHeader, readBody, readHeaders, readLine, readLine, removeBody, removeHeader, setBody, setHeader, setHeader, setHeader, setHeader, writeHeadersAndBodypublic HttpRequest(HttpRequest.Method method, java.net.URI uri, java.lang.String httpVersion, java.io.InputStream in) throws java.io.IOException
java.io.IOExceptionpublic HttpRequest(HttpRequest.Method method, java.net.URI uri, java.lang.String httpVersion)
public static HttpRequest read(java.io.InputStream in) throws java.io.IOException, InvalidHttpMessageException
InputStream.java.io.IOExceptionInvalidHttpMessageExceptionpublic HttpRequest.Method getMethod()
HttpRequest.Methodpublic java.lang.String getHttpVersion()
public java.net.URI getUri()
public final void setUri(java.net.URI uri)
public java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getParameterList()
throws java.io.IOException
java.io.IOExceptionpublic void setParameterList(java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> parameters)
@Nullable public java.lang.String[] getParameter(java.lang.String name) throws java.io.IOException
namejava.io.IOExceptionpublic void addParameter(java.lang.String name,
java.lang.String value)
throws java.io.IOException
java.io.IOExceptionpublic void addParameter(java.lang.String name,
java.lang.String[] values)
throws java.io.IOException
java.io.IOExceptionpublic void setParameter(java.lang.String name,
java.lang.String value)
throws java.io.IOException
java.io.IOExceptionpublic void setParameter(java.lang.String name,
java.lang.String[] values)
throws java.io.IOException
java.io.IOExceptionpublic void setMethod(HttpRequest.Method method)
public void setHttpVersion(java.lang.String httpVersion)
public void write(java.io.OutputStream out)
throws java.io.IOException
OutputStream.java.io.IOExceptionpublic static void read(java.nio.channels.ReadableByteChannel in,
Multiplexer multiplexer,
ConsumerWhichThrows<HttpRequest,java.io.IOException> requestConsumer)
throws java.io.IOException
in through the multiplexer and passes it to the requestConsumer.java.io.IOException