public interface Request
Modifier and Type | Method and Description |
---|---|
ByteBuf |
getBuffer() |
byte[] |
getBytes()
The request body as bytes.
|
MediaType |
getContentType()
A structured representation of the "Content-Type" header value of the request.
|
Set<Cookie> |
getCookies()
The cookies that were sent with the request.
|
Headers |
getHeaders()
The request headers.
|
InputStream |
getInputStream()
Provides an input stream of the request body.
|
HttpMethod |
getMethod()
The method of the request.
|
String |
getPath()
The URI without the query string and leading forward slash.
|
String |
getQuery()
The query string component of the request URI, without the "?".
|
MultiValueMap<String,String> |
getQueryParams()
TBD.
|
String |
getText()
The request body as text.
|
String |
getUri()
The complete URI of the request (path + query string).
|
String |
oneCookie(String name)
Returns the value of the cookie with the specified name if it was sent.
|
void |
writeBodyTo(OutputStream destination)
Writes the request body bytes to the given output stream.
|
HttpMethod getMethod()
String getUri()
This value is always absolute (i.e. begins with "/
").
String getQuery()
If the request does not contain a query component, an empty string will be returned.
String getPath()
MultiValueMap<String,String> getQueryParams()
ByteBuf getBuffer()
MediaType getContentType()
Set<Cookie> getCookies()
An empty set will be returned if no cookies were sent.
@Nullable String oneCookie(String name)
If there is more than one cookie with this name, this method will throw an exception.
name
- The name of the cookie to get the value ofString getText()
The encoding used will be determined by the value of the Content-Type header of the request.
byte[] getBytes()
If there is no request body, or it is 0 length, an empty byte array will be returned.
void writeBodyTo(OutputStream destination) throws IOException
If there is no request body, or it is 0 length, nothing will be written to the stream.
destination
- The stream to write the bytes toIOException
- If destination throws an exception during writingInputStream getInputStream()
Headers getHeaders()