public class ApacheHttpProvider extends HttpProvider implements TransportProvider
Modifier and Type | Class and Description |
---|---|
class |
ApacheHttpProvider.ApacheCredentialsProvider |
DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, MSG_CODE_OTHER, MSG_CODE_PREFIX, MSG_COMMS_FAILURE, MSG_NO_CONTENT
Modifier | Constructor and Description |
---|---|
protected |
ApacheHttpProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkResponse(org.apache.http.HttpResponse httpResponse) |
protected boolean |
checkResponse(org.apache.http.HttpResponse httpResponse,
int attempt) |
void |
close()
Release all resources acquired by this provider
|
protected org.apache.http.client.HttpClient |
createHttpClient() |
byte[] |
delete(java.lang.String path,
java.lang.String acceptType)
Send a DELETE request to the server
|
byte[] |
get(java.lang.String path,
java.lang.String acceptType)
Send a GET request to the server
|
protected void |
handleIOException(java.io.IOException ioException,
int attempt) |
boolean |
head(java.lang.String path)
Send a HEAD request to the server
|
byte[] |
post(java.lang.String path,
byte[] content,
java.lang.String contentType,
java.lang.String acceptType)
Send a POST request to the server
|
byte[] |
put(java.lang.String path,
byte[] content,
java.lang.String contentType)
Send a PUT request to the server
|
void |
setProxyLocation(java.net.URI proxyLocation)
Route requests through a proxy server.
|
void |
setServiceCredentials(Credentials serviceCredentials)
Set the service credentials
|
void |
setServiceLocation(java.net.URI serviceLocation)
Set the service endpoint location
|
void |
setUserAgent(java.lang.String userAgent)
Set the content of the User-Agent header to be passed to the server.
|
java.lang.String |
toString() |
getMessage, getPort, getStatusMessage
compress, decompress, getDebugLevel, getProxyCredentials, getProxyLocation, getProxySelector, getRequestPath, getServiceCredentials, getServiceLocation, getUserAgent, readResponseBody, setDebugLevel, setProxyCredentials
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setDebugLevel, setProxyCredentials
protected org.apache.http.client.HttpClient createHttpClient()
public java.lang.String toString()
toString
in class TransportProviderBase
public void setServiceLocation(java.net.URI serviceLocation) throws AnaplanAPITransportException
setServiceLocation
in interface TransportProvider
setServiceLocation
in class TransportProviderBase
serviceLocation
- the service endpoint locationAnaplanAPITransportException
public void setServiceCredentials(Credentials serviceCredentials) throws AnaplanAPITransportException
setServiceCredentials
in interface TransportProvider
setServiceCredentials
in class TransportProviderBase
serviceCredentials
- the service credentialsAnaplanAPITransportException
public void setProxyLocation(java.net.URI proxyLocation) throws AnaplanAPITransportException
setProxyLocation
in interface TransportProvider
setProxyLocation
in class TransportProviderBase
proxyLocation
- the location of the proxy serverAnaplanAPITransportException
public void setUserAgent(java.lang.String userAgent)
setUserAgent
in interface TransportProvider
setUserAgent
in class TransportProviderBase
userAgent
- The User-Agent header valuepublic byte[] get(java.lang.String path, java.lang.String acceptType) throws AnaplanAPITransportException
get
in interface TransportProvider
get
in class TransportProviderBase
path
- The path relative to the service endpoint locationacceptType
- The Accept header to indicate the format of content
expected in the reponse bodyAnaplanAPITransportException
- a communication or protocol error occuredpublic boolean head(java.lang.String path) throws AnaplanAPITransportException
head
in interface TransportProvider
head
in class TransportProviderBase
path
- The path relative to the service endpoint locationAnaplanAPITransportException
- a communication or protocol error occuredpublic byte[] post(java.lang.String path, byte[] content, java.lang.String contentType, java.lang.String acceptType) throws AnaplanAPITransportException
post
in interface TransportProvider
post
in class TransportProviderBase
path
- The path relative to the service endpoint locationcontent
- The content to send in the request bodycontentType
- The value for the Content-Type header to indicate
the format of the content in the request bodyacceptType
- The Accept header to indicate the format of content
expected in the reponse bodyAnaplanAPITransportException
- a communication or protocol error occuredpublic byte[] put(java.lang.String path, byte[] content, java.lang.String contentType) throws AnaplanAPITransportException
put
in interface TransportProvider
put
in class TransportProviderBase
path
- The path relative to the service endpoint locationcontent
- The content to send in the request bodycontentType
- The value for the Content-Type header to indicate
the format of the content in the request bodyAnaplanAPITransportException
- a communication or protocol error occuredpublic byte[] delete(java.lang.String path, java.lang.String acceptType) throws AnaplanAPITransportException
delete
in interface TransportProvider
delete
in class TransportProviderBase
path
- The path relative to the service endpoint locationacceptType
- The Accept header to indicate the format of content
expected in the reponse bodyAnaplanAPITransportException
- a communication or protocol error occuredpublic void close()
close
in interface TransportProvider
close
in class TransportProviderBase
protected void checkResponse(org.apache.http.HttpResponse httpResponse) throws AnaplanAPITransportException
AnaplanAPITransportException
protected boolean checkResponse(org.apache.http.HttpResponse httpResponse, int attempt) throws AnaplanAPITransportException
AnaplanAPITransportException
protected void handleIOException(java.io.IOException ioException, int attempt) throws AnaplanAPITransportException
AnaplanAPITransportException