Class ApacheHttpClient5Options.Builder
java.lang.Object
org.opensearch.client.transport.httpclient5.ApacheHttpClient5Options.Builder
- All Implemented Interfaces:
TransportOptions.Builder,ObjectBuilder<TransportOptions>
- Enclosing class:
ApacheHttpClient5Options
public static class ApacheHttpClient5Options.Builder
extends Object
implements TransportOptions.Builder
-
Method Summary
Modifier and TypeMethodDescriptionAdd the provided header to the request.build()onWarnings(Function<List<String>, Boolean> listener) Called if there are warnings to determine if those warnings should fail the request.voidsetHttpAsyncResponseConsumerFactory(HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory) Set theHttpAsyncResponseConsumerFactoryused to create oneAsyncResponseConsumercallback per retry.setParameter(String name, String value) setRequestConfig(org.apache.hc.client5.http.config.RequestConfig requestConfig) set RequestConfig, which can set socketTimeout, connectTimeout and so on by requestvoidsetWarningsHandler(WarningsHandler warningsHandler) How this request should handle warnings.
-
Method Details
-
addHeader
Add the provided header to the request.- Specified by:
addHeaderin interfaceTransportOptions.Builder- Parameters:
name- the header namevalue- the header value- Throws:
NullPointerException- ifnameorvalueis null.
-
setParameter
- Specified by:
setParameterin interfaceTransportOptions.Builder
-
onWarnings
Called if there are warnings to determine if those warnings should fail the request.- Specified by:
onWarningsin interfaceTransportOptions.Builder
-
setHttpAsyncResponseConsumerFactory
public void setHttpAsyncResponseConsumerFactory(HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory) Set theHttpAsyncResponseConsumerFactoryused to create oneAsyncResponseConsumercallback per retry. Controls how the response body gets streamed from a non-blocking HTTP connection on the client side.- Parameters:
httpAsyncResponseConsumerFactory- factory for creatingAsyncResponseConsumer.- Throws:
NullPointerException- ifhttpAsyncResponseConsumerFactoryis null.
-
setWarningsHandler
How this request should handle warnings. If null (the default) then this request will default to the behavior dictacted by `setStrictDeprecationMode`.This can be set to
WarningsHandler.PERMISSIVEif the client should ignore all warnings which is the same behavior as setting strictDeprecationMode to true. It can be set toWarningsHandler.STRICTif the client should fail if there are any warnings which is the same behavior as settings strictDeprecationMode to false.It can also be set to a custom implementation of WarningsHandler to permit only certain warnings or to fail the request if the warnings returned don't exactly match some set.
- Parameters:
warningsHandler- theWarningsHandlerto be used
-
setRequestConfig
public ApacheHttpClient5Options.Builder setRequestConfig(org.apache.hc.client5.http.config.RequestConfig requestConfig) set RequestConfig, which can set socketTimeout, connectTimeout and so on by request- Parameters:
requestConfig- http client RequestConfig- Returns:
- Builder
-
build
- Specified by:
buildin interfaceObjectBuilder<TransportOptions>
-