Package com.dnanexus
Class DXHTTPRequest
- java.lang.Object
-
- com.dnanexus.DXHTTPRequest
-
public class DXHTTPRequest extends Object
Class for making a raw DNAnexus API call via HTTP.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDXHTTPRequest.RetryStrategyIndicates whether a particular API request can be retried.
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.http.client.HttpClienthttpclient
-
Constructor Summary
Constructors Constructor Description DXHTTPRequest()Construct the DXHTTPRequest using the default DXEnvironment.DXHTTPRequest(DXEnvironment env)Construct the DXHTTPRequest using the given DXEnvironment.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected org.apache.http.client.HttpClientgetHttpClient()Allows custom DXHTTPRequest to setup overridden httpClientprotected org.apache.http.protocol.HttpContextgetHttpContext()Allows custom HttpContext to setup overridden http.com.fasterxml.jackson.databind.JsonNoderequest(String resource, com.fasterxml.jackson.databind.JsonNode data)Deprecated.Userequest(String, JsonNode, RetryStrategy)instead.com.fasterxml.jackson.databind.JsonNoderequest(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.Stringrequest(String resource, String data)Deprecated.Userequest(String, String, RetryStrategy)instead.Stringrequest(String resource, String data, DXHTTPRequest.RetryStrategy retryStrategy)Issues a request against the specified resource and returns the result as a String.
-
-
-
Constructor Detail
-
DXHTTPRequest
public DXHTTPRequest()
Construct the DXHTTPRequest using the default DXEnvironment.
-
DXHTTPRequest
public DXHTTPRequest(DXEnvironment env)
Construct the DXHTTPRequest using the given DXEnvironment.
-
-
Method Detail
-
getHttpClient
protected org.apache.http.client.HttpClient getHttpClient()
Allows custom DXHTTPRequest to setup overridden httpClient
-
getHttpContext
protected org.apache.http.protocol.HttpContext getHttpContext()
Allows custom HttpContext to setup overridden http. parameters e.g. http.conn-manager.timeout for PoolingHttpClientConnectionManager
-
request
@Deprecated public com.fasterxml.jackson.databind.JsonNode request(String resource, com.fasterxml.jackson.databind.JsonNode data)
Deprecated.Userequest(String, JsonNode, RetryStrategy)instead.Issues a request against the specified resource (assuming requests ARE safe to be retried) and returns the result as a JSON object.- Parameters:
resource- Name of resource, e.g. "/file-XXXX/describe"data- Request payload (to be converted to JSON)- Throws:
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).
-
request
public 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.- Parameters:
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 retried- Throws:
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).
-
request
@Deprecated public String request(String resource, String data)
Deprecated.Userequest(String, String, RetryStrategy)instead.Issues a request against the specified resource (assuming requests ARE safe to be retried) and returns the result as a String.- Parameters:
resource- Name of resource, e.g. "/file-XXXX/describe"data- Request payload (String to be sent verbatim)- Throws:
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).
-
request
public String request(String resource, String data, DXHTTPRequest.RetryStrategy retryStrategy)
Issues a request against the specified resource and returns the result as a String.- Parameters:
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 retried- Throws:
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).
-
-