Package com.datastax.astra.internal.http
Class RetryHttpClient
java.lang.Object
com.datastax.astra.internal.http.RetryHttpClient
Http Client using JDK11 client with a retry mechanism.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Headers, Api is usig JSONstatic final String
Headers, Api is usig JSONstatic final String
Header param.static final String
Headers param to insert the token for devops API.static final String
Headers param to insert the token.static final String
Headers param to insert the conte type.static final String
Headers param to insert the unique identifier for the request.static final String
Headers param to insert the user agent identifying the client.static final String
Headers name to insert the user agent identifying the client.protected final HttpClient
JDK11 Http client.protected final HttpClientOptions
Http Options.static final String
Value for the requested with.protected final com.evanlennick.retry4j.config.RetryConfig
Default retry configuration.Default settings in Request and Retry -
Constructor Summary
ConstructorDescriptionDefault initialization of http client.RetryHttpClient
(HttpClientOptions config) Initialize the instance with all items -
Method Summary
Modifier and TypeMethodDescriptionHelp to build the HTTP request.Main Method executing HTTP Request.com.evanlennick.retry4j.Status
<HttpResponse<String>> Implementing retries.long
Return value for default response time.Give access to the user agent header.parseHttpResponse
(HttpResponse<String> response) Parse HTTP response as a ApiResponseHttp.Helper to build the HTTP request.
-
Field Details
-
CONTENT_TYPE_JSON
Headers, Api is usig JSON- See Also:
-
CONTENT_TYPE_GRAPHQL
Headers, Api is usig JSON- See Also:
-
HEADER_ACCEPT
Header param.- See Also:
-
HEADER_CASSANDRA
Headers param to insert the token.- See Also:
-
HEADER_REQUEST_ID
Headers param to insert the unique identifier for the request.- See Also:
-
HEADER_CONTENT_TYPE
Headers param to insert the conte type.- See Also:
-
HEADER_AUTHORIZATION
Headers param to insert the token for devops API.- See Also:
-
HEADER_USER_AGENT
Headers name to insert the user agent identifying the client.- See Also:
-
HEADER_REQUESTED_WITH
Headers param to insert the user agent identifying the client.- See Also:
-
REQUEST_WITH
Value for the requested with.- See Also:
-
httpClient
JDK11 Http client. -
httpClientOptions
Http Options. -
retryConfig
protected final com.evanlennick.retry4j.config.RetryConfig retryConfigDefault retry configuration. -
userAgents
Default settings in Request and Retry
-
-
Constructor Details
-
RetryHttpClient
public RetryHttpClient()Default initialization of http client. -
RetryHttpClient
Initialize the instance with all items- Parameters:
config
- configuration of the HTTP CLIENT.
-
-
Method Details
-
getUserAgentHeader
Give access to the user agent header.- Returns:
- user agent header
-
getResponseTimeoutInSeconds
public long getResponseTimeoutInSeconds()Return value for default response time.- Returns:
- default response time
-
post
Helper to build the HTTP request.- Parameters:
url
- target urltoken
- authentication tokenbody
- request body- Returns:
- http request
-
builtHttpRequest
public HttpRequest builtHttpRequest(String method, String url, String token, String body, String contentType) Help to build the HTTP request.- Parameters:
method
- http method nameurl
- http urltoken
- token for authorization headerbody
- body of the requestcontentType
- content type for the request- Returns:
- the http request.
-
parseHttpResponse
Parse HTTP response as a ApiResponseHttp.- Parameters:
response
- http response from the JDK11 client- Returns:
- the response as an ApiResponseHttp
-
executeHttp
public ApiResponseHttp executeHttp(String method, String url, String token, String body, String contentType) Main Method executing HTTP Request.- Parameters:
method
- http methodurl
- urltoken
- authentication tokenbody
- request bodycontentType
- request content type- Returns:
- basic request
-
executeHttpRequest
Implementing retries.- Parameters:
req
- current request- Returns:
- the closeable response
-