public interface HttpRequest extends HttpMessage
Modifier and Type | Interface and Description |
---|---|
static interface |
HttpRequest.HttpPart
Represents one part inside a multipart (
multipart/form-data ) HTTP request. |
Modifier and Type | Method and Description |
---|---|
default Optional<String> |
getFirstQueryParameter(String name)
The first query parameter with the given name, if any.
|
String |
getMethod()
The HTTP method of this request, such as
"POST" or "GET" . |
Map<String,HttpRequest.HttpPart> |
getParts()
Returns the parts inside this multipart (
multipart/form-data ) HTTP request. |
String |
getPath()
The path part of the URI for this request, without any query.
|
Optional<String> |
getQuery()
The query part of the URI for this request.
|
Map<String,List<String>> |
getQueryParameters()
The query parameters of this request.
|
String |
getUri()
The full URI of this request as it arrived at the server.
|
getCharacterEncoding, getContentLength, getContentType, getFirstHeader, getHeaders, getInputStream, getReader
String getPath()
http://foo.com/bar/baz?this=that
, then this method will return /bar/baz
.Optional<String> getQuery()
http://foo.com/bar/baz?this=that
, then this method will return this=that
.
If there is no query part, the returned Optional
is empty.Map<String,List<String>> getQueryParameters()
http://foo.com/bar?thing=thing1&thing=thing2&cat=hat
, then the returned map will map
thing
to the list "thing1", "thing2"
and cat
to the list with the
single element "hat"
.default Optional<String> getFirstQueryParameter(String name)
http://foo.com/bar?thing=thing1&thing=thing2&cat=hat
, then
getFirstQueryParameter("thing")
will return Optional.of("thing1")
and
getFirstQueryParameter("something")
will return Optional.empty()
. This is a
more convenient alternative to getQueryParameters()
.Map<String,HttpRequest.HttpPart> getParts()
multipart/form-data
) HTTP request. Each entry
in the returned map has the name of the part as its key and the contents as the associated
value.IllegalStateException
- if the content type
is not
multipart/form-data
.Copyright © 2019. All rights reserved.