public class RestClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected HashMap<String,String> |
headers |
protected org.apache.http.client.HttpClient |
httpClient |
protected static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
RestClient(org.apache.http.client.HttpClient client)
Default constructor to create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearAddedHeaders()
Deprecated.
As of release 2.1, due to thread safety issues. Use an HttpRequestInterceptor
added to the HttpClient build time, as shown in https://redmine.dataone.org/issues/7638
|
org.apache.http.HttpResponse |
doDeleteRequest(String url,
org.apache.http.client.config.RequestConfig requestConfig)
send a Delete request to the resource and get the response
|
org.apache.http.HttpResponse |
doGetRequest(String url,
org.apache.http.client.config.RequestConfig requestConfig)
send a GET request to the resource and get the response
|
org.apache.http.HttpResponse |
doHeadRequest(String url,
org.apache.http.client.config.RequestConfig requestConfig)
send a Head request to the resource and get the response
|
org.apache.http.HttpResponse |
doPostRequest(String url,
SimpleMultipartEntity mpe,
org.apache.http.client.config.RequestConfig requestConfig)
send a POST request to the resource and get the response
|
org.apache.http.HttpResponse |
doPutRequest(String url,
SimpleMultipartEntity mpe,
org.apache.http.client.config.RequestConfig requestConfig)
send a PUT request to the resource and get the response
|
HashMap<String,String> |
getAddedHeaders()
Deprecated.
As of release 2.1, due to thread safety issues. Use an HttpRequestInterceptor
added to the HttpClient build time, as shown in https://redmine.dataone.org/issues/7638
|
org.apache.http.client.HttpClient |
getHttpClient()
Gets the DefaultHttpClient instance used to make the connection
|
String |
getLatestRequestUrl()
returns a description of the latest rest call made by this instance.
|
String |
getLatestRequestUrl(Thread t)
To support cross thread retrieval of request info, a parameterized
form of this method.
|
void |
setHeader(String name,
String value)
Deprecated.
As of release 2.1, due to thread safety issues. Use an HttpRequestInterceptor
added to the HttpClient build time, as shown in https://redmine.dataone.org/issues/7638
|
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Sets the HttpClient instance used for the connection.
|
protected static org.apache.commons.logging.Log log
protected org.apache.http.client.HttpClient httpClient
public RestClient(org.apache.http.client.HttpClient client)
public String getLatestRequestUrl()
public String getLatestRequestUrl(Thread t)
t - public org.apache.http.client.HttpClient getHttpClient()
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
httpClient - @Deprecated public void setHeader(String name, String value)
name - value - @Deprecated public HashMap<String,String> getAddedHeaders()
@Deprecated public void clearAddedHeaders()
public org.apache.http.HttpResponse doGetRequest(String url, org.apache.http.client.config.RequestConfig requestConfig) throws org.apache.http.client.ClientProtocolException, IOException
IOExceptionorg.apache.http.client.ClientProtocolExceptionpublic org.apache.http.HttpResponse doHeadRequest(String url, org.apache.http.client.config.RequestConfig requestConfig) throws org.apache.http.client.ClientProtocolException, IOException
IOExceptionorg.apache.http.client.ClientProtocolExceptionpublic org.apache.http.HttpResponse doDeleteRequest(String url, org.apache.http.client.config.RequestConfig requestConfig) throws org.apache.http.client.ClientProtocolException, IOException
IOExceptionorg.apache.http.client.ClientProtocolExceptionpublic org.apache.http.HttpResponse doPostRequest(String url, SimpleMultipartEntity mpe, org.apache.http.client.config.RequestConfig requestConfig) throws org.apache.http.client.ClientProtocolException, IOException
IOExceptionorg.apache.http.client.ClientProtocolExceptionpublic org.apache.http.HttpResponse doPutRequest(String url, SimpleMultipartEntity mpe, org.apache.http.client.config.RequestConfig requestConfig) throws org.apache.http.client.ClientProtocolException, IOException
IOExceptionorg.apache.http.client.ClientProtocolExceptionCopyright © 2020. All Rights Reserved.