- All Superinterfaces:
BaseRequest
Represents a client request in a client exchange.
Once the request has been sent to the endpoint it is no longer possible to modify it resulting in IllegalStateException
on such operations.
- Since:
- 1.6
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSets the request authority.Optional
<? extends RequestBody> body()
Returns the request body when the request method allows it.headers
(Consumer<OutboundRequestHeaders> headersConfigurer) Configures the HTTP headers to send in the request.boolean
Determines whether the request headers have been sent to the endpoint.Sets the request method.Sets the request path.Methods inherited from interface io.inverno.mod.http.base.BaseRequest
getAuthority, getLocalAddress, getLocalCertificates, getMethod, getPath, getPathAbsolute, getPathBuilder, getQuery, getRemoteAddress, getRemoteCertificates, getScheme, headers, queryParameters
-
Method Details
-
isHeadersWritten
boolean isHeadersWritten()Determines whether the request headers have been sent to the endpoint.
- Returns:
- true if headers have been sent, false otherwise
-
method
Sets the request method.
This actually overrides the method provided when the enclosing exchange was created by the
Endpoint
. It defaults toMethod.GET
if none is specified.- Parameters:
method
- the request method- Returns:
- the request
- Throws:
IllegalStateException
- if the request has already been sent to the endpoint
-
authority
Sets the request authority.
- Parameters:
authority
- the request authority- Returns:
- the request
- Throws:
IllegalStateException
- if the request has already been sent to the endpoint
-
path
Sets the request path.
This actually overrides the request target path provided when the request was created using
Endpoint.exchange(io.inverno.mod.http.base.Method, java.lang.String)
orEndpoint.exchange(io.inverno.mod.http.base.Method, java.lang.String, io.inverno.mod.http.base.ExchangeContext)
.- Parameters:
path
- the request target path- Returns:
- the request
- Throws:
IllegalStateException
- if the request has already been sent to the endpoint
-
headers
Configures the HTTP headers to send in the request.
- Parameters:
headersConfigurer
- an outbound request headers configurer- Returns:
- the request
- Throws:
IllegalStateException
- if the request has already been sent to the endpoint
-
body
Returns the request body when the request method allows it.
- Returns:
- an optional returning the request body when the method allows it (i.e.
POST
PUT
...) or an empty optional (i.e.GET
...). - Throws:
IllegalStateException
- if the request has already been sent to the endpoint
-