public abstract class HttpConnection extends Object
| Modifier and Type | Field and Description |
|---|---|
protected HttpConfiguration |
config
Subclasses must set the http configuration in the
createAndconfigureHttpConnection() method.
|
protected HttpURLConnection |
connection
Subclasses must create and set the connection in the
createAndconfigureHttpConnection() method.
|
| Constructor and Description |
|---|
HttpConnection() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
createAndconfigureHttpConnection(HttpConfiguration clientConfiguration)
create and configure HttpsURLConnection object
|
String |
execute(String url,
String payload,
Map<String,String> headers)
Executes HTTP request
|
protected String |
read(BufferedReader reader) |
protected void |
setHttpHeaders(Map<String,String> headers)
Set headers for HttpsURLConnection object
|
abstract void |
setupClientSSL(String certPath,
String certKey)
Set ssl parameters for client authentication
|
protected HttpConfiguration config
protected HttpURLConnection connection
public String execute(String url, String payload, Map<String,String> headers) throws InvalidResponseDataException, IOException, InterruptedException, HttpErrorException, ClientActionRequiredException
url - payload - headers - InvalidResponseDataExceptionIOExceptionInterruptedExceptionHttpErrorExceptionClientActionRequiredExceptionpublic abstract void setupClientSSL(String certPath, String certKey) throws SSLConfigurationException
certPath - certKey - SSLConfigurationExceptionpublic abstract void createAndconfigureHttpConnection(HttpConfiguration clientConfiguration) throws IOException
clientConfiguration - MalformedURLExceptionIOExceptionprotected String read(BufferedReader reader) throws IOException
IOExceptionCopyright © 2016. All Rights Reserved.