public class HttpContext extends Object
| Constructor and Description | 
|---|
| HttpContext(String protocol,
           String hostname,
           int port)Constructor that takes a protocol, hostname and port. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | DELETE(String partialUrl)Execute a DELETE call against the partial URL. | 
| void | DELETE(String partialUrl,
      Map<String,String> headers,
      List<String> queryParams)Execute a DELETE call against the partial URL. | 
| protected void | executeDeleteRequest(URI uri)Execute a DELETE request. | 
| protected void | executeDeleteRequest(URI uri,
                    Map<String,String> headers,
                    List<String> queryParams)Execute a DELETE request. | 
| protected <T> com.google.common.base.Optional<T> | executeGetRequest(URI uri,
                 Map<String,String> headers,
                 List<String> queryParams,
                 Type returnType)Execute a GET request and return the result. | 
| protected <T> com.google.common.base.Optional<T> | executeGetRequest(URI uri,
                 Type returnType)Execute a GET request and return the result. | 
| protected void | executePatchRequest(URI uri,
                   Object obj)Execute a PATCH request. | 
| protected void | executePatchRequest(URI uri,
                   Object obj,
                   Map<String,String> headers,
                   List<String> queryParams)Execute a PATCH request. | 
| protected <T> com.google.common.base.Optional<T> | executePatchRequest(URI uri,
                   Object obj,
                   Map<String,String> headers,
                   List<String> queryParams,
                   Type returnType)Execute a PATCH request with a return object. | 
| protected com.google.common.base.Optional<org.apache.http.HttpResponse> | executePostRequest(URI uri,
                  Object obj)Execute a POST request. | 
| protected com.google.common.base.Optional<org.apache.http.HttpResponse> | executePostRequest(URI uri,
                  Object obj,
                  Map<String,String> headers)Execute a POST request. | 
| protected <T> com.google.common.base.Optional<T> | executePostRequest(URI uri,
                  Object obj,
                  Map<String,String> headers,
                  Type returnType)Execute a POST request with a return object. | 
| protected <T> com.google.common.base.Optional<T> | executePostRequest(URI uri,
                  Object obj,
                  Type returnType)Execute a POST request with a return object. | 
| <T> com.google.common.base.Optional<T> | GET(String partialUrl,
   Map<String,String> headers,
   List<String> queryParams,
   Type returnType)Execute a GET call against the partial URL and deserialize the results. | 
| <T> com.google.common.base.Optional<T> | GET(String partialUrl,
   Type returnType)Execute a GET call against the partial URL and deserialize the results. | 
| void | PATCH(String partialUrl,
     Object payload)Execute a PATCH call against the partial URL. | 
| void | PATCH(String partialUrl,
     Object payload,
     Map<String,String> headers,
     List<String> queryParams)Execute a PATCH call against the partial URL. | 
| <T> com.google.common.base.Optional<T> | PATCH(String partialUrl,
     Object payload,
     Map<String,String> headers,
     List<String> queryParams,
     Type returnType)Execute a PATCH call against the partial URL. | 
| <T> com.google.common.base.Optional<T> | PATCH(String partialUrl,
     Object payload,
     Type returnType)Execute a PATCH call against the partial URL. | 
| com.google.common.base.Optional<org.apache.http.HttpResponse> | POST(String partialUrl,
    Object payload)Execute a POST call against the partial URL. | 
| com.google.common.base.Optional<org.apache.http.HttpResponse> | POST(String partialUrl,
    Object payload,
    Map<String,String> headers)Execute a POST call against the partial URL. | 
| <T> com.google.common.base.Optional<T> | POST(String partialUrl,
    Object payload,
    Map<String,String> headers,
    Type returnType)Execute a POST call against the partial URL. | 
| <T> com.google.common.base.Optional<T> | POST(String partialUrl,
    Object payload,
    Type returnType)Execute a POST call against the partial URL. | 
protected static final Type ERROR
public <T> com.google.common.base.Optional<T> GET(String partialUrl, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildreturnType - The expected return typeIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public <T> com.google.common.base.Optional<T> GET(String partialUrl, Map<String,String> headers, List<String> queryParams, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildreturnType - The expected return typeheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public com.google.common.base.Optional<org.apache.http.HttpResponse> POST(String partialUrl, Object payload) throws IOException
partialUrl - The partial URL to buildpayload - The object to use for the POSTIOException - if there is a communication error.public com.google.common.base.Optional<org.apache.http.HttpResponse> POST(String partialUrl, Object payload, Map<String,String> headers) throws IOException
partialUrl - The partial URL to buildpayload - The object to use for the POSTheaders - A set of headers to add to the requestIOException - if there is a communication error.public <T> com.google.common.base.Optional<T> POST(String partialUrl, Object payload, Type returnType) throws IOException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildpayload - The object to use for the POSTreturnType - The expected return typeIOException - if there is a communication error.public <T> com.google.common.base.Optional<T> POST(String partialUrl, Object payload, Map<String,String> headers, Type returnType) throws IOException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildpayload - The object to use for the POSTheaders - A set of headers to add to the requestreturnType - The expected return typeIOException - if there is a communication error.public void PATCH(String partialUrl, Object payload) throws IOException, URISyntaxException
partialUrl - The partial URL to buildpayload - The object to use for the PATCHIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public void PATCH(String partialUrl, Object payload, Map<String,String> headers, List<String> queryParams) throws IOException, URISyntaxException
partialUrl - The partial URL to buildpayload - The object to use for the PATCHheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public <T> com.google.common.base.Optional<T> PATCH(String partialUrl, Object payload, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildpayload - The object to use for the PATCHreturnType - The expected return typeIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public <T> com.google.common.base.Optional<T> PATCH(String partialUrl, Object payload, Map<String,String> headers, List<String> queryParams, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objectpartialUrl - The partial URL to buildpayload - The object to use for the PATCHheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestreturnType - The expected return typeIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public void DELETE(String partialUrl) throws IOException, URISyntaxException
partialUrl - The partial URL to buildIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.public void DELETE(String partialUrl, Map<String,String> headers, List<String> queryParams) throws IOException, URISyntaxException
partialUrl - The partial URL to buildheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected <T> com.google.common.base.Optional<T> executeGetRequest(URI uri, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objecturi - The URI to callreturnType - The type to marshall the result back intoIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected <T> com.google.common.base.Optional<T> executeGetRequest(URI uri, Map<String,String> headers, List<String> queryParams, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objecturi - The URI to callreturnType - The type to marshall the result back intoheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected com.google.common.base.Optional<org.apache.http.HttpResponse> executePostRequest(URI uri, Object obj) throws IOException
uri - The URI to callobj - The object to use for the POSTIOException - if there is a communication error.protected com.google.common.base.Optional<org.apache.http.HttpResponse> executePostRequest(URI uri, Object obj, Map<String,String> headers) throws IOException
uri - The URI to callobj - The object to use for the POSTheaders - A set of headers to add to the requestIOException - if there is a communication error.protected <T> com.google.common.base.Optional<T> executePostRequest(URI uri, Object obj, Type returnType) throws IOException
T - The type parameter used for the return objecturi - The URI to callobj - The object to use for the POSTreturnType - The type to marshall the result back intoIOException - if there is a communication error.protected <T> com.google.common.base.Optional<T> executePostRequest(URI uri, Object obj, Map<String,String> headers, Type returnType) throws IOException
T - The type parameter used for the return objecturi - The URI to callobj - The object to use for the POSTheaders - A set of headers to add to the requestreturnType - The type to marshall the result back intoIOException - if there is a communication error.protected void executePatchRequest(URI uri, Object obj) throws IOException, URISyntaxException
uri - The URI to callobj - The object to use for the PATCHIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected void executePatchRequest(URI uri, Object obj, Map<String,String> headers, List<String> queryParams) throws IOException, URISyntaxException
uri - The URI to callobj - The object to use for the PATCHheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected <T> com.google.common.base.Optional<T> executePatchRequest(URI uri, Object obj, Map<String,String> headers, List<String> queryParams, Type returnType) throws IOException, URISyntaxException
T - The type parameter used for the return objecturi - The URI to callobj - The object to use for the PATCHheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestreturnType - The type to marshall the result back intoIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected void executeDeleteRequest(URI uri) throws IOException, URISyntaxException
uri - The URI to callIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.protected void executeDeleteRequest(URI uri, Map<String,String> headers, List<String> queryParams) throws IOException, URISyntaxException
uri - The URI to callheaders - A set of headers to add to the requestqueryParams - A set of query parameters to add to the requestIOException - if there is a communication error.URISyntaxException - if there is a format error in the URL.Copyright © 2020. All rights reserved.