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 java.lang.Object implements TransportOptions.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApacheHttpClient5Options.BuilderaddHeader(java.lang.String name, java.lang.String value)Add the provided header to the request.ApacheHttpClient5Optionsbuild()TransportOptions.BuilderonWarnings(java.util.function.Function<java.util.List<java.lang.String>,java.lang.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.TransportOptions.BuildersetParameter(java.lang.String name, java.lang.String value)ApacheHttpClient5Options.BuildersetRequestConfig(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 Detail
-
addHeader
public ApacheHttpClient5Options.Builder addHeader(java.lang.String name, java.lang.String value)
Add the provided header to the request.- Specified by:
addHeaderin interfaceTransportOptions.Builder- Parameters:
name- the header namevalue- the header value- Throws:
java.lang.NullPointerException- ifnameorvalueis null.
-
setParameter
public TransportOptions.Builder setParameter(java.lang.String name, java.lang.String value)
- Specified by:
setParameterin interfaceTransportOptions.Builder
-
onWarnings
public TransportOptions.Builder onWarnings(java.util.function.Function<java.util.List<java.lang.String>,java.lang.Boolean> listener)
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:
java.lang.NullPointerException- ifhttpAsyncResponseConsumerFactoryis null.
-
setWarningsHandler
public void setWarningsHandler(WarningsHandler warningsHandler)
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
public ApacheHttpClient5Options build()
- Specified by:
buildin interfaceObjectBuilder<TransportOptions>
-
-