Package com.algolia.search
Class JavaNetHttpRequester
- java.lang.Object
-
- com.algolia.search.JavaNetHttpRequester
-
- All Implemented Interfaces:
HttpRequester
public final class JavaNetHttpRequester extends Object implements HttpRequester
Implementation ofHttpRequesterfor the built-in Java.net 11 HTTP Client
-
-
Constructor Summary
Constructors Constructor Description JavaNetHttpRequester(ConfigBase config)Build the reusable instance of httpClient with the given configuration.JavaNetHttpRequester(ConfigBase config, HttpClient.Builder builder)Build the reusable instance of httpClient with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Nothing to do here.CompletableFuture<HttpResponse>performRequestAsync(HttpRequest request)Sends the http request asynchronously to the API If the request is time out it creates a new response object with timeout set to true Otherwise it throws a run time exception
-
-
-
Constructor Detail
-
JavaNetHttpRequester
public JavaNetHttpRequester(@Nonnull ConfigBase config)Build the reusable instance of httpClient with the given configuration.- Parameters:
config- HTTPClient agnostic Algolia's configuration.
-
JavaNetHttpRequester
public JavaNetHttpRequester(@Nonnull ConfigBase config, HttpClient.Builder builder)Build the reusable instance of httpClient with the given configuration.- Parameters:
config- HTTPClient agnostic Algolia's configurationbuilder- Builder for HTTP Clients
-
-
Method Detail
-
performRequestAsync
public CompletableFuture<HttpResponse> performRequestAsync(@Nonnull HttpRequest request)
Sends the http request asynchronously to the API If the request is time out it creates a new response object with timeout set to true Otherwise it throws a run time exception- Specified by:
performRequestAsyncin interfaceHttpRequester- Parameters:
request- the request to send- Throws:
AlgoliaRuntimeException- When an error occurred processing the request on the server side
-
close
public void close()
Nothing to do here. Java.net HTTP Client is not closeable.- Specified by:
closein interfaceHttpRequester
-
-