- All Superinterfaces:
BaseRequest
An interceptable request is exposed in the InterceptableExchange
to proxy the original request that is about to be sent to the endpoint and the actual request after it has been sent to the
endpoint.
Once the request has been sent to the endpoint it is no longer possible to modify the interceptable request resulting in IllegalStateException
on such operations.
- Since:
- 1.6
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSets the request authority.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
isSent()
Determines whether the request was 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
-
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 exchange 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
InterceptableRequest headers(Consumer<OutboundRequestHeaders> headersConfigurer) throws IllegalStateException 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
Optional<InterceptableRequestBody> 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
...).
-
isSent
boolean isSent()Determines whether the request was sent to the endpoint.
Once the request is sent, it is no longer possible to modify it resultig in
IllegalArgumentException
.- Returns:
- true if the request has been sent, false otherwise
-