Module io.helidon.webclient.api
Package io.helidon.webclient.api
Interface ClientRequest<T extends ClientRequest<T>>
- Type Parameters:
T
- type of the implementation, to support fluent API
- All Known Subinterfaces:
FullClientRequest<T>
,Http1ClientRequest
,Http2ClientRequest
- All Known Implementing Classes:
ClientRequestBase
,HttpClientRequest
public interface ClientRequest<T extends ClientRequest<T>>
Request can be reused within a single thread, but it remembers all explicitly configured headers and URI.
Implementation is not expected to be thread safe!
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Handle output stream. -
Method Summary
Modifier and TypeMethodDescriptiondefault T
Accepted media types.default T
accept
(HttpMediaType... accepted) Accepted media types.connection
(ClientConnection connection) This method is for explicit connection use by this request.default T
contentType
(MediaType contentType) Sets the content type of the request.boolean
Whether to follow redirects.followRedirects
(boolean followRedirects) Whether to follow redirects.fragment
(UriFragment fragment) Set fragment of the URI.default T
Set fragment of the URI.Set an HTTP header.default T
header
(HeaderName name, String... values) Set an HTTP header.default T
header
(HeaderName name, List<String> values) Set an HTTP header with multiple values.headers()
Get a (mutable) instance of outgoing headers.Configure headers.headers
(Consumer<ClientRequestHeaders> headersConsumer) Update headers.keepAlive
(boolean keepAlive) Whether to use keep alive with this request.int
Maximal number of redirects to follow.maxRedirects
(int maxRedirects) Max number of the followed redirects.outputStream
(ClientRequest.OutputStreamHandler outputStreamConsumer) Handle output stream and submit the request.default <T> ClientResponseTyped
<T> outputStream
(ClientRequest.OutputStreamHandler outputStreamConsumer, Class<T> requestedType) Handle output stream and request a specific type.default T
Configure path to call.Replace a placeholder in URI with an actual value.Add a property to be used by this request.Proxy configuration for this specific request.queryParam
(String name, String... values) Add query parameter.readContinueTimeout
(Duration readContinueTimeout) Read 100-Continue timeout for this request.readTimeout
(Duration readTimeout) Read timeout for this request.default HttpClientResponse
request()
Request without an entity.default <E> ClientResponseTyped
<E> Request without sending an entity.default <E> E
requestEntity
(Class<E> type) Request entity without sending a request entity, asking for entity only.Resolved URI that will be used to invoke this request.skipUriEncoding
(boolean skip) Disable uri encoding.Submit an entity.default <T> ClientResponseTyped
<T> Submit an entity and request a specific type.TLS configuration for this specific request.Configure request URI.default T
Configure URI.Configure URI.
-
Method Details
-
uri
Configure URI.- Parameters:
uri
- uri to resolve against base URI, or to use if absolute- Returns:
- updated request
-
path
Configure path to call.- Parameters:
uri
- path- Returns:
- updated request
-
tls
TLS configuration for this specific request.- Parameters:
tls
- tls configuration- Returns:
- updated request
-
proxy
Proxy configuration for this specific request.- Parameters:
proxy
- proxy configuration- Returns:
- updated request
-
uri
Configure URI.- Parameters:
uri
- uri to resolve against base URI, or to use if absolute- Returns:
- updated request
-
uri
Configure request URI. This always replaces the existing URI (even if base URI is configured).- Parameters:
uri
- uri to resolve against base URI, or to use if absolute- Returns:
- updated request
-
header
Set an HTTP header.- Parameters:
header
- header to set- Returns:
- updated request
-
header
Set an HTTP header.- Parameters:
name
- header namevalues
- header values- Returns:
- updated request
-
header
Set an HTTP header with multiple values.- Parameters:
name
- header namevalues
- header values- Returns:
- updated request
-
headers
Configure headers. Copy all headers from suppliedHeaders
instance.- Parameters:
headers
- to copy- Returns:
- updated request
-
headers
Update headers.- Parameters:
headersConsumer
- consumer of client request headers- Returns:
- updated request
-
accept
Accepted media types. Supports quality factor and wildcards.- Parameters:
accepted
- media types to accept- Returns:
- updated request
-
accept
Accepted media types. Supports quality factor and wildcards.- Parameters:
acceptedTypes
- media types to accept- Returns:
- updated request
-
contentType
Sets the content type of the request.- Parameters:
contentType
- content type of the request.- Returns:
- updated request
-
pathParam
Replace a placeholder in URI with an actual value.- Parameters:
name
- name of parametervalue
- value of parameter- Returns:
- updated request
-
queryParam
Add query parameter.- Parameters:
name
- name of parametervalues
- value(s) of parameter- Returns:
- updated request
-
fragment
Set fragment of the URI.- Parameters:
fragment
- fragment- Returns:
- updated request
-
fragment
Set fragment of the URI.- Parameters:
fragment
- fragment- Returns:
- updated request
-
followRedirects
Whether to follow redirects.- Parameters:
followRedirects
- follow redirects- Returns:
- updated request
-
maxRedirects
Max number of the followed redirects.- Parameters:
maxRedirects
- max followed redirects- Returns:
- updated request
-
followRedirects
boolean followRedirects()Whether to follow redirects.- Returns:
- follow redirects
-
maxRedirects
int maxRedirects()Maximal number of redirects to follow. This is to prevent infinite redirects.- Returns:
- max number of redirects
-
request
Request without an entity.- Returns:
- response
-
headers
ClientRequestHeaders headers()Get a (mutable) instance of outgoing headers.- Returns:
- client request headers
-
request
Request without sending an entity.- Type Parameters:
E
- type of entity- Parameters:
type
- type of entity- Returns:
- correctly typed response
- See Also:
-
requestEntity
Request entity without sending a request entity, asking for entity only. This method will fail if the status is not in successful family.- Type Parameters:
E
- type of the entity to read from the response- Parameters:
type
- type of requested entity- Returns:
- correctly typed entity
- Throws:
HttpException
- in case the response status is not success
-
submit
Submit an entity.- Parameters:
entity
- request entity- Returns:
- response
-
submit
Submit an entity and request a specific type.- Type Parameters:
T
- type of response entity- Parameters:
entity
- request entityrequestedType
- type of response entity- Returns:
- correctly typed response
-
outputStream
Handle output stream and submit the request.- Parameters:
outputStreamConsumer
- output stream to write request entity- Returns:
- response
-
outputStream
default <T> ClientResponseTyped<T> outputStream(ClientRequest.OutputStreamHandler outputStreamConsumer, Class<T> requestedType) Handle output stream and request a specific type.- Type Parameters:
T
- type of response entity- Parameters:
outputStreamConsumer
- output stream consumer to write request entityrequestedType
- type of response entity- Returns:
- correctly typed response
-
resolvedUri
UriInfo resolvedUri()Resolved URI that will be used to invoke this request.- Returns:
- URI to invoke
-
connection
This method is for explicit connection use by this request.- Parameters:
connection
- connection to use for this request- Returns:
- updated client request
-
skipUriEncoding
Disable uri encoding.- Parameters:
skip
- set totrue
to disable URI encoding (false
by default)- Returns:
- updated client request
-
property
Add a property to be used by this request.- Parameters:
propertyName
- property namepropertyValue
- property value- Returns:
- updated builder instance
-
keepAlive
Whether to use keep alive with this request.- Parameters:
keepAlive
- use keep alive- Returns:
- updated client request
-
readTimeout
Read timeout for this request.- Parameters:
readTimeout
- response read timeout- Returns:
- updated client request
-
readContinueTimeout
Read 100-Continue timeout for this request. This read timeout is used when 100-Continue is sent by the client, before it sends an entity.- Parameters:
readContinueTimeout
- read 100-Continue timeout duration- Returns:
- updated client request
- See Also:
-