public interface WebClientRequestBuilder
Fluent API builder that is used by
WebClient
to create an outgoing request.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Request to a server. -
Method Summary
Modifier and TypeMethodDescriptionMedia types which are accepted in the response.default WebClientRequestBuilder
Adds header values for a specified name.default WebClientRequestBuilder
Adds header values for a specified name.default WebClientRequestBuilder
addHeaders
(Parameters parameters) Copies all of the mappings from the specifiedparameters
to this response headers instance.allowChunkedEncoding
(boolean allowChunkedEncoding) Whether chunkedHttp.Header.TRANSFER_ENCODING
should be added to the headers if the entity is chunked.connectTimeout
(long amount, TimeUnit unit) Sets new connection timeout for this request.contentType
(MediaType contentType) Content type of the request.Explicitly configure a context to use.followRedirects
(boolean followRedirects) Sets if redirects should be followed at this request or not.Fragment of the request.headers()
Get a (mutable) instance of outgoing headers.Configure headers.headers
(Function<WebClientRequestHeaders, Headers> headers) Function from parameter is executed on top of stored headers.httpVersion
(Http.Version httpVersion) Sets http version.keepAlive
(boolean keepAlive) Whether connection should be kept alive after request.path
(HttpRequest.Path path) Path of the request.Path of the request.Add a property to be used by aWebClientService
.Override client proxy configuration.queryParam
(String name, String... values) Add a query parameter.queryParams
(Parameters queryParams) Configure query parameters.Returns reader context of the request builder.readTimeout
(long amount, TimeUnit unit) Sets new read timeout for this request.request()
Performs prepared request without expecting to receive any specific type.<T> Single<T>
request
(GenericType<T> responseType) Performs prepared request and transforms response to requested type.<T> Single<T>
Performs prepared request and transforms response to requested type.requestId
(long requestId) Set new request id.Disables final uri encoding.submit()
Performs prepared request.Performs prepared request and submitting request entity.<T> Single<T>
Performs prepared request and submitting request entity.submit
(Flow.Publisher<DataChunk> requestEntity) Performs prepared request and submitting request entity usingFlow.Publisher
.<T> Single<T>
submit
(Flow.Publisher<DataChunk> requestEntity, Class<T> responseType) Performs prepared request and submitting request entity usingFlow.Publisher
.submit
(Function<MessageBodyWriterContext, Flow.Publisher<DataChunk>> function) Performs prepared request and submitting request entity using a marshalling function.String representation of request uri.RequestURI
.RequestURL
.Returns writer context of the request builder.
-
Method Details
-
uri
String representation of request uri. Replaces baseUri defined in client builder.- Parameters:
uri
- request uri- Returns:
- updated builder instance
-
uri
RequestURL
. Replaces baseUri defined in client builder.- Parameters:
url
- request url- Returns:
- updated builder instance
-
uri
RequestURI
. Replaces baseUri defined in client builder.- Parameters:
uri
- request uri- Returns:
- updated builder instance
-
skipUriEncoding
WebClientRequestBuilder skipUriEncoding()Disables final uri encoding. This setting skips all parts ofURI
from encoding.- Returns:
- updated builder instance
-
followRedirects
Sets if redirects should be followed at this request or not.- Parameters:
followRedirects
- follow redirects- Returns:
- updated builder instance
-
property
Add a property to be used by aWebClientService
.- Parameters:
propertyName
- property namepropertyValue
- property value- Returns:
- updated builder instance
-
context
Explicitly configure a context to use. This method is not needed when running within a scope of a Helidon server, such as Web Server, gRPC Server, MicroProfile Server, or when processing a Helidon message consumer.- Parameters:
context
- context to be used by the outbound request, to look for security context, parent tracing span and similar- Returns:
- updated builder instance
-
headers
WebClientRequestHeaders headers()Get a (mutable) instance of outgoing headers.- Returns:
- client request headers
-
queryParam
Add a query parameter. Appends these query parameters to the query parameters defined in the request uri.- Parameters:
name
- query namevalues
- query value- Returns:
- updated builder instance
-
proxy
Override client proxy configuration.- Parameters:
proxy
- request proxy- Returns:
- updated builder instance
-
headers
Configure headers. Copy all headers from suppliedHeaders
instance.- Parameters:
headers
- to copy- Returns:
- updated builder instance
-
headers
Function from parameter is executed on top of stored headers. This approach is here to allow as to add any header via specialized method while using builder pattern.- Parameters:
headers
- function which adds headers- Returns:
- updated builder instance
-
addHeader
Adds header values for a specified name.- Parameters:
name
- header namevalues
- header values- Returns:
- this instance of
WebClientRequestBuilder
- Throws:
NullPointerException
- if the specified name is null.- See Also:
-
addHeader
Adds header values for a specified name.- Parameters:
name
- header namevalues
- header values- Returns:
- this instance of
WebClientRequestBuilder
- Throws:
NullPointerException
- if the specified name is null.- See Also:
-
addHeaders
Copies all of the mappings from the specifiedparameters
to this response headers instance.- Parameters:
parameters
- to copy.- Returns:
- this instance of
WebClientRequestBuilder
- Throws:
NullPointerException
- if the specifiedparameters
are null.- See Also:
-
queryParams
Configure query parameters. Appends these query parameters to the query parameters defined in the request uri. Copy all query parameters from suppliedParameters
instance.- Parameters:
queryParams
- to copy- Returns:
- updated builder instance
-
readerContext
MessageBodyReaderContext readerContext()Returns reader context of the request builder.- Returns:
- request reader context
-
writerContext
MessageBodyWriterContext writerContext()Returns writer context of the request builder.- Returns:
- request writer context
-
httpVersion
Sets http version.- Parameters:
httpVersion
- http version- Returns:
- updated builder instance
-
connectTimeout
Sets new connection timeout for this request.- Parameters:
amount
- amount of timeunit
- time unit- Returns:
- updated builder instance
-
readTimeout
Sets new read timeout for this request.- Parameters:
amount
- amount of timeunit
- time unit- Returns:
- updated builder instance
-
fragment
Fragment of the request. Replaces fragment defined in the request uri.- Parameters:
fragment
- request fragment- Returns:
- updated builder instance
-
path
Path of the request. Appends this path to the path defined in the request uri.- Parameters:
path
- path- Returns:
- updated builder instance
-
path
Path of the request. Appends this path to the path defined in the request uri.- Parameters:
path
- path- Returns:
- updated builder instance
-
contentType
Content type of the request.- Parameters:
contentType
- content type- Returns:
- updated builder instance
-
accept
Media types which are accepted in the response.- Parameters:
mediaTypes
- media types- Returns:
- updated builder instance
-
keepAlive
Whether connection should be kept alive after request.- Parameters:
keepAlive
- keep alive- Returns:
- updated builder instance
-
requestId
Set new request id. This id is used in logging messages.- Parameters:
requestId
- new request id- Returns:
- updated builder instance
-
allowChunkedEncoding
Whether chunkedHttp.Header.TRANSFER_ENCODING
should be added to the headers if the entity is chunked.- Parameters:
allowChunkedEncoding
- allow chunked encoding to be added- Returns:
- updated builder instance
-
request
Performs prepared request and transforms response to requested type. When transformation is done the returnedCompletionStage
is notified.- Type Parameters:
T
- response type- Parameters:
responseType
- requested response type- Returns:
- request completion stage
-
request
Performs prepared request and transforms response to requested type. When transformation is done the returnedCompletionStage
is notified.- Type Parameters:
T
- response type- Parameters:
responseType
- requested response type- Returns:
- request completion stage
-
request
Single<WebClientResponse> request()Performs prepared request without expecting to receive any specific type. Response is not converted and returnedCompletionStage
is notified.- Returns:
- request completion stage
-
submit
Single<WebClientResponse> submit()Performs prepared request. When response is received, it is not converted to any other specific type and returnedCompletionStage
is notified.- Returns:
- request completion stage
-
submit
Performs prepared request and submitting request entity usingFlow.Publisher
. When response is received, it is converted to response type and returnedCompletionStage
is notified.- Type Parameters:
T
- response type- Parameters:
requestEntity
- request entityresponseType
- requested response type- Returns:
- request completion stage
-
submit
Performs prepared request and submitting request entity. When response is received, it is converted to response type and returnedCompletionStage
is notified.- Type Parameters:
T
- response type- Parameters:
requestEntity
- request entityresponseType
- requested response type- Returns:
- request completion stage
-
submit
Performs prepared request and submitting request entity usingFlow.Publisher
. When response is received, it is not converted to any other specific type and returnedCompletionStage
is notified.- Parameters:
requestEntity
- request entity- Returns:
- request completion stage
-
submit
Performs prepared request and submitting request entity. When response is received, it is not converted to any other specific type and returnedCompletionStage
is notified.- Parameters:
requestEntity
- request entity- Returns:
- request completion stage
-
submit
Single<WebClientResponse> submit(Function<MessageBodyWriterContext, Flow.Publisher<DataChunk>> function) Performs prepared request and submitting request entity using a marshalling function. When response is received, it is not converted to any other specific type and returnedCompletionStage
is notified.- Parameters:
function
- marshalling function- Returns:
- request completion stage
-