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