Package com.basistech.rosette.api
Class HttpRosetteAPI.Builder
java.lang.Object
com.basistech.rosette.api.HttpRosetteAPI.Builder
- Enclosing class:
- HttpRosetteAPI
Builder for HttpRosetteAPI objects.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadditionalHeader
(String name, String value) Specify an additional header value to include in all requests.build()
Build the API object.connectionConcurrency
(Integer concurrency) The maximum number of concurrent requests that may be in progress.failureRetries
(Integer failureRetries) How many times to retry 5xx errors from the service.httpClient
(org.apache.http.impl.client.CloseableHttpClient httpClient) The Apache HTTP components client object to use for communications with the service.Specify the API key.onlyAcceptKnownFields
(boolean onlyAcceptKnownFields) Only process the response from server if all fields are recognized.Specify the URL for the service.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
key
Specify the API key. This is required for use with the public API, and not necessary with on-premise deployments.- Parameters:
key
- the key string.- Returns:
- this.
-
url
Specify the URL for the service. This is required for use with on-premise deployments, but should not be called for uses of the public API.- Parameters:
url
- the URL.- Returns:
- this.
-
failureRetries
How many times to retry 5xx errors from the service. Some 5xx errors result from transient infrastructure problems.- Parameters:
failureRetries
- the number of retries. The default is 1.- Returns:
- this.
-
connectionConcurrency
The maximum number of concurrent requests that may be in progress. The default value is 2. For the public API, you should only specify a larger value if you have signed up for a plan that allows for more concurrency.- Parameters:
concurrency
- the number of concurrent connections. The default is 2.- Returns:
- this.
-
httpClient
public HttpRosetteAPI.Builder httpClient(org.apache.http.impl.client.CloseableHttpClient httpClient) The Apache HTTP components client object to use for communications with the service. If this is not called (or is null),HttpRosetteAPI
will create a client object.- Parameters:
httpClient
- the client object.- Returns:
- this.
-
additionalHeader
Specify an additional header value to include in all requests. This can be helpful for use with corporate proxies, or as directed by Basis Technology customer engineering.- Parameters:
name
- the header name.value
- the header value.- Returns:
- this.
-
onlyAcceptKnownFields
Only process the response from server if all fields are recognized. If set and a new field is returned in the response, exception will be thrown.- Parameters:
onlyAcceptKnownFields
- whether to accept known fields.- Returns:
- this.
-
build
Build the API object.- Returns:
- the new API object.
- Throws:
HttpRosetteAPIException
- for some error encountered.
-