public class DXHTTPRequest extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DXHTTPRequest.RetryStrategy
Indicates whether a particular API request can be retried.
|
Modifier and Type | Field and Description |
---|---|
protected org.apache.http.client.HttpClient |
httpclient |
Constructor and Description |
---|
DXHTTPRequest()
Construct the DXHTTPRequest using the default DXEnvironment.
|
DXHTTPRequest(DXEnvironment env)
Construct the DXHTTPRequest using the given DXEnvironment.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.client.HttpClient |
getHttpClient()
Allows custom DXHTTPRequest to setup overridden httpClient
|
protected org.apache.http.protocol.HttpContext |
getHttpContext()
Allows custom HttpContext to setup overridden http.
|
com.fasterxml.jackson.databind.JsonNode |
request(String resource,
com.fasterxml.jackson.databind.JsonNode data)
Deprecated.
Use
request(String, JsonNode, RetryStrategy) instead. |
com.fasterxml.jackson.databind.JsonNode |
request(String resource,
com.fasterxml.jackson.databind.JsonNode data,
DXHTTPRequest.RetryStrategy retryStrategy)
Issues a request against the specified resource and returns the result as a JSON object.
|
String |
request(String resource,
String data)
Deprecated.
Use
request(String, String, RetryStrategy) instead. |
String |
request(String resource,
String data,
DXHTTPRequest.RetryStrategy retryStrategy)
Issues a request against the specified resource and returns the result as a String.
|
public DXHTTPRequest()
public DXHTTPRequest(DXEnvironment env)
protected org.apache.http.client.HttpClient getHttpClient()
protected org.apache.http.protocol.HttpContext getHttpContext()
@Deprecated public com.fasterxml.jackson.databind.JsonNode request(String resource, com.fasterxml.jackson.databind.JsonNode data)
request(String, JsonNode, RetryStrategy)
instead.resource
- Name of resource, e.g. "/file-XXXX/describe"data
- Request payload (to be converted to JSON)DXAPIException
- If the server returns a complete response with an HTTP status code
other than 200 (OK).DXHTTPException
- If an error occurs while making the HTTP request or obtaining the
response (includes HTTP protocol errors).public com.fasterxml.jackson.databind.JsonNode request(String resource, com.fasterxml.jackson.databind.JsonNode data, DXHTTPRequest.RetryStrategy retryStrategy)
resource
- Name of resource, e.g. "/file-XXXX/describe"data
- Request payload (to be converted to JSON)retryStrategy
- Indicates whether the request is idempotent and can be retriedDXAPIException
- If the server returns a complete response with an HTTP status code
other than 200 (OK).DXHTTPException
- If an error occurs while making the HTTP request or obtaining the
response (includes HTTP protocol errors).@Deprecated public String request(String resource, String data)
request(String, String, RetryStrategy)
instead.resource
- Name of resource, e.g. "/file-XXXX/describe"data
- Request payload (String to be sent verbatim)DXAPIException
- If the server returns a complete response with an HTTP status code
other than 200 (OK).DXHTTPException
- If an error occurs while making the HTTP request or obtaining the
response (includes HTTP protocol errors).public String request(String resource, String data, DXHTTPRequest.RetryStrategy retryStrategy)
resource
- Name of resource, e.g. "/file-XXXX/describe"data
- Request payload (String to be sent verbatim)retryStrategy
- Indicates whether the request is idempotent and can be retriedDXAPIException
- If the server returns a complete response with an HTTP status code
other than 200 (OK).DXHTTPException
- If an error occurs while making the HTTP request or obtaining the
response (includes HTTP protocol errors).Copyright © 2023. All Rights Reserved.