public class HttpMultipartRestClient extends Object implements MultipartRestClient
Modifier and Type | Field and Description |
---|---|
protected org.apache.http.client.config.RequestConfig |
baseRequestConfig |
static String |
DEFAULT_TIMEOUT_PARAM |
static Integer |
DEFAULT_TIMEOUT_VALUE |
protected static org.apache.commons.logging.Log |
log |
protected RestClient |
rc |
protected X509Session |
x509Session |
Constructor and Description |
---|
HttpMultipartRestClient()
creates an HttpMultipartRestClient configured with the certificate in the
default or set location in the CertificateManager.
|
HttpMultipartRestClient(AuthTokenSession authTokenSession) |
HttpMultipartRestClient(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder,
X509Session x509session)
This constructor is used to give users flexibility in creating the HttpClient,
but takes care of configuring the ConnectionManager with the X509Session
parameter.
|
HttpMultipartRestClient(org.apache.http.client.HttpClient httpClient,
X509Session x509session)
The basic constructor to implement the MultipartRestClient interface
using apache HttpClient and X509Certificate.
|
HttpMultipartRestClient(String subjectString)
creates an HttpMultipartRestClient configured with the certificate registered
to the CertificateManager.
|
HttpMultipartRestClient(X509Session x509Session)
creates an HttpMultipartRestClient configured with the certificate
contained in the X509Session.
|
Modifier and Type | Method and Description |
---|---|
void |
clearDefaultTimeout()
Clears the default timeout parameter: "D1Client.http.default.timeouts.ms".
|
void |
closeIdleConnections()
Deprecated.
|
InputStream |
doDeleteRequest(String url,
Integer timeoutMillisecs) |
InputStream |
doGetRequest(String url,
Integer timeoutMillisecs)
Perform an HTTP GET request, setting the headers first and parsing /filtering
exceptions to the exception stream on the response into their
respective java instances.
|
InputStream |
doGetRequest(String url,
Integer timeoutMillisecs,
boolean followRedirect) |
org.apache.http.Header[] |
doGetRequestForHeaders(String url,
Integer timeoutMillisecs) |
org.apache.http.Header[] |
doHeadRequest(String url,
Integer timeoutMillisecs) |
InputStream |
doPostRequest(String url,
SimpleMultipartEntity entity,
Integer timeoutMillisecs) |
InputStream |
doPutRequest(String url,
SimpleMultipartEntity entity,
Integer timeoutMillisecs) |
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 HttpClient instance used to make the connection
|
String |
getLatestRequestUrl()
Gets the string representation of the current Thread's latest http request
via this instance.
|
String |
getLatestRequestUrl(Thread t)
Gets the string representation of the specified Thread's latest http request
via this instance.
|
X509Session |
getSession() |
void |
setDefaultTimeout(Integer timeout)
Sets the default timeout parameter: "D1Client.http.default.timeouts.ms"
to the given Integer.
|
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
build time, as shown in https://redmine.dataone.org/issues/7638
|
protected static org.apache.commons.logging.Log log
protected RestClient rc
protected org.apache.http.client.config.RequestConfig baseRequestConfig
protected X509Session x509Session
public static final String DEFAULT_TIMEOUT_PARAM
public static final Integer DEFAULT_TIMEOUT_VALUE
public HttpMultipartRestClient(org.apache.http.client.HttpClient httpClient, X509Session x509session)
httpClient
- x509Session
- public HttpMultipartRestClient(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder, X509Session x509session) throws ClientSideException
httpClientBuilder
- x509session
- ClientSideException
public HttpMultipartRestClient() throws IOException, ClientSideException
IOException
ClientSideException
public HttpMultipartRestClient(String subjectString) throws IOException, ClientSideException
subjectString
- FileNotFoundException
IOException
ClientSideException
public HttpMultipartRestClient(X509Session x509Session) throws IOException, ClientSideException
x509Session
- IOException
ClientSideException
public HttpMultipartRestClient(AuthTokenSession authTokenSession)
public org.apache.http.client.HttpClient getHttpClient()
public String getLatestRequestUrl()
getLatestRequestUrl
in interface MultipartRestClient
public String getLatestRequestUrl(Thread t)
@Deprecated public void closeIdleConnections()
public InputStream doGetRequest(String url, Integer timeoutMillisecs) throws BaseException, ClientSideException
MultipartRestClient
doGetRequest
in interface MultipartRestClient
url
- - the encoded url stringBaseException
ClientSideException
public InputStream doGetRequest(String url, Integer timeoutMillisecs, boolean followRedirect) throws BaseException, ClientSideException
doGetRequest
in interface MultipartRestClient
BaseException
ClientSideException
public org.apache.http.Header[] doGetRequestForHeaders(String url, Integer timeoutMillisecs) throws BaseException, ClientSideException
doGetRequestForHeaders
in interface MultipartRestClient
BaseException
ClientSideException
public InputStream doDeleteRequest(String url, Integer timeoutMillisecs) throws BaseException, ClientSideException
doDeleteRequest
in interface MultipartRestClient
BaseException
ClientSideException
public org.apache.http.Header[] doHeadRequest(String url, Integer timeoutMillisecs) throws BaseException, ClientSideException
doHeadRequest
in interface MultipartRestClient
BaseException
ClientSideException
public InputStream doPutRequest(String url, SimpleMultipartEntity entity, Integer timeoutMillisecs) throws BaseException, ClientSideException
doPutRequest
in interface MultipartRestClient
BaseException
ClientSideException
public InputStream doPostRequest(String url, SimpleMultipartEntity entity, Integer timeoutMillisecs) throws BaseException, ClientSideException
doPostRequest
in interface MultipartRestClient
BaseException
ClientSideException
@Deprecated public void setHeader(String name, String value)
name
- value
- @Deprecated public HashMap<String,String> getAddedHeaders()
public X509Session getSession()
getSession
in interface MultipartRestClient
public void setDefaultTimeout(Integer timeout)
RequestConfig
if no timeout value is provided when making the API calls.timeout
- the number of milliseconds to wait before timing out.
Determines connect timeout, connection request timeout, and
socket timeout.public void clearDefaultTimeout()
RequestConfig
if no timeout value is provided when making the API calls.
The default timeout value determines connect timeout,
connection request timeout, and socket timeout.Copyright © 2020. All Rights Reserved.