public interface Request extends MutableRegistry
Modifier and Type | Method and Description |
---|---|
default <O> Request |
add(Class<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
default Request |
add(Object object)
Adds a registry entry.
|
default <O> Request |
add(TypeToken<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
default <O> Request |
addLazy(Class<O> type,
Supplier<? extends O> supplier)
Adds a lazily created entry to the registry.
|
<O> Request |
addLazy(TypeToken<O> type,
Supplier<? extends O> supplier)
Adds a lazily created entry to the registry.
|
TypedData |
getBody()
The body of the request.
|
Set<Cookie> |
getCookies()
The cookies that were sent with the request.
|
Headers |
getHeaders()
The request headers.
|
HostAndPort |
getLocalAddress()
The address of the local network interface that received the request.
|
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 |
getRawUri()
The raw URI of the request.
|
HostAndPort |
getRemoteAddress()
The address of the client that initiated the request.
|
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.
|
remove, remove
HttpMethod getMethod()
String getRawUri()
This value may be an absolute URI or an absolute path.
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()
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 ofTypedData getBody()
If this request does not have a body, an non null object is still returned but it effectively has no data.
Headers getHeaders()
HostAndPort getRemoteAddress()
HostAndPort getLocalAddress()
default <O> Request add(Class<? super O> type, O object)
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryobject
- the actual registry entrydefault <O> Request add(TypeToken<? super O> type, O object)
add
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entryobject
- the actual registry entrydefault Request add(Object object)
add
in interface RegistrySpec
object
- the object to add to the registrydefault <O> Request addLazy(Class<O> type, Supplier<? extends O> supplier)
The supplier will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.
addLazy
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entrysupplier
- the supplier for creating the object when needed<O> Request addLazy(TypeToken<O> type, Supplier<? extends O> supplier)
The supplier will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.
addLazy
in interface RegistrySpec
O
- the public type of the registry entrytype
- the public type of the registry entrysupplier
- the supplier for creating the object when needed