public interface Request extends MutableRegistry
Modifier and Type | Method and Description |
---|---|
<O> Request |
add(Class<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
Request |
add(Object object)
Adds a registry entry.
|
<O> Request |
add(TypeToken<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
<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 |
getProtocol()
The HTTP protocol of the request.
|
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.
|
Instant |
getTimestamp()
The timestamp for when this request was received.
|
String |
getUri()
The complete URI of the request (path + query string).
|
boolean |
isAjaxRequest()
A flag representing whether or not the request originated via AJAX.
|
String |
oneCookie(String name)
Returns the value of the cookie with the specified name if it was sent.
|
remove, remove
backedBy, builder, empty, first, first, get, get, getAll, getAll, join, maybeGet, maybeGet, of, single, single, single
addLazyAsync, addLazyAsync, with
HttpMethod getMethod()
String getProtocol()
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()
boolean isAjaxRequest()
Instant getTimestamp()
<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 entry<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 entryRequest add(Object object)
add
in interface RegistrySpec
object
- the object to add to the registry<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