public class HttpComponents42Client extends AbstractClient
AbstractClient
, that makes use of
Apache HttpComponents 4.2
for HTTP transfers.LIVE_API, SANDBOX_API
Constructor and Description |
---|
HttpComponents42Client(String apiBaseUrl,
String consumerToken,
String consumerSecret)
Creates an instance of
HttpComponents42Client . |
HttpComponents42Client(String apiBaseUrl,
String consumerToken,
String consumerSecret,
org.apache.http.client.HttpClient httpClient)
Creates an instance of
HttpComponents42Client . |
Modifier and Type | Method and Description |
---|---|
protected oauth.signpost.OAuthConsumer |
buildOAuthConsumer(String apiAccessKey,
String apiAccessSecret)
Creates an
OAuthConsumer object for access credentials. |
protected oauth.signpost.OAuthProvider |
buildOAuthProvider(String apiBaseUrl)
Creates an
OAuthProvider for the IS24-Webservice. |
protected Response |
createResponse(org.apache.http.HttpResponse response)
Retrieves a
Response from a HttpResponse . |
protected Response |
sendVideoUploadRequest(URL url,
RequestMethod method,
String auth,
InputStream input,
String fileName,
long fileSize)
Sends a video with an authentication value to the IS24-Webservice.
|
protected Response |
sendXmlAttachmentRequest(URL url,
RequestMethod method,
String xml,
InputStream input,
String fileName,
String mimeType)
Sends a XML string together with a file to the IS24-Webservice.
|
protected Response |
sendXmlRequest(URL url,
RequestMethod method,
String xml)
Sends a XML string to the IS24-Webservice.
|
void |
setDefaultHttpClient()
Use a default
HttpClient for HTTP traffic. |
void |
setDefaultHttpClient(int timeout)
Use a default
HttpClient for HTTP traffic. |
void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Use a specific
HttpClient for HTTP traffic. |
authorize, authorize, authorizeAfterVerification, authorizeAfterVerification, fetchVerification, fetchVerification, getApiBaseUrl, getAuthConsumer, getAuthProvider, getEncodedParameterValue, getEncoding, getUrlEncodedValue
public HttpComponents42Client(String apiBaseUrl, String consumerToken, String consumerSecret)
HttpComponents42Client
.apiBaseUrl
- base URL of the IS24-Webservice (see AbstractClient.LIVE_API
and
AbstractClient.SANDBOX_API
)consumerToken
- consumer token, that identifies the application at the IS24-WebserviceconsumerSecret
- consumer secret, that identifies the application at the IS24-Webservicepublic HttpComponents42Client(String apiBaseUrl, String consumerToken, String consumerSecret, org.apache.http.client.HttpClient httpClient)
HttpComponents42Client
.apiBaseUrl
- base URL of the IS24-Webservice (see AbstractClient.LIVE_API
and
AbstractClient.SANDBOX_API
)consumerToken
- consumer token, that identifies the application at the IS24-WebserviceconsumerSecret
- consumer secret, that identifies the application at the IS24-WebservicehttpClient
- HttpClient
, that is used for HTTP transfersprotected oauth.signpost.OAuthConsumer buildOAuthConsumer(String apiAccessKey, String apiAccessSecret)
AbstractClient
OAuthConsumer
object for access credentials.
Different implementations of AbstractClient
may create different
OAuthConsumer
objects.
buildOAuthConsumer
in class AbstractClient
apiAccessKey
- access or verification tokenapiAccessSecret
- access or verification secretOAuthConsumer
for the provided credentialsprotected oauth.signpost.OAuthProvider buildOAuthProvider(String apiBaseUrl)
AbstractClient
OAuthProvider
for the IS24-Webservice.
Different implementations of AbstractClient
may create different
OAuthProvider
objects.
buildOAuthProvider
in class AbstractClient
apiBaseUrl
- URL of the IS24-WebserviceOAuthProvider
for the provided URLprotected Response createResponse(org.apache.http.HttpResponse response) throws IOException
Response
from a HttpResponse
.response
- HttpResponse
, that was received by the clientResponse
of the requestIOException
- if the Response
can't be obtainedprotected Response sendXmlRequest(URL url, RequestMethod method, String xml) throws IOException, oauth.signpost.exception.OAuthException
AbstractClient
This function must be implemendet by specific implementations of
AbstractClient
.
sendXmlRequest
in class AbstractClient
url
- URL of the IS24-Webservice, where the request is sent tomethod
- HTTP method of the outgoing requestxml
- XML string, that is sent to the IS24-WebserviceIOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedprotected Response sendXmlAttachmentRequest(URL url, RequestMethod method, String xml, InputStream input, String fileName, String mimeType) throws IOException, oauth.signpost.exception.OAuthException
AbstractClient
This function must be implemendet by specific implementations of
AbstractClient
.
sendXmlAttachmentRequest
in class AbstractClient
url
- URL of the IS24-Webservice, where the request is sent tomethod
- the HTTP method of the outgoing requestxml
- the XML string, that is sent to the IS24-Webserviceinput
- the file content, that is sent to the IS24-WebservicefileName
- the name of the file, that is sent to the IS24-WebservicemimeType
- the MIME-type of the file, that is sent to the IS24-WebserviceIOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedprotected Response sendVideoUploadRequest(URL url, RequestMethod method, String auth, InputStream input, String fileName, long fileSize) throws IOException, oauth.signpost.exception.OAuthException
AbstractClient
This function must be implemendet by specific implementations of
AbstractClient
.
sendVideoUploadRequest
in class AbstractClient
url
- URL of the IS24-Webservice, where the request is sent tomethod
- HTTP method of the outgoing requestauth
- authentication value, that is sent to the IS24-Webserviceinput
- file content, that is sent to the IS24-WebservicefileName
- name of the file, that is sent to the IS24-WebservicefileSize
- size of the file, that is sent to the IS24-Webservice (in bytes)IOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedpublic void setDefaultHttpClient()
HttpClient
for HTTP traffic.public void setDefaultHttpClient(int timeout)
HttpClient
for HTTP traffic.timeout
- timeout for HTTP communication (in milliseconds)public void setHttpClient(org.apache.http.client.HttpClient httpClient)
HttpClient
for HTTP traffic.httpClient
- HttpClient
, that is used for HTTP communicationCopyright © 2014 OpenEstate. All rights reserved.