public class HttpsRequestDispatcher extends java.lang.Object implements RequestDispatcher
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT |
static int |
DEFAULT_READ_TIMEOUT |
| Constructor and Description |
|---|
HttpsRequestDispatcher(java.net.URL endpoint)
Create a dispatcher using no authentication.
|
HttpsRequestDispatcher(java.net.URL endpoint,
java.lang.String username,
java.lang.String password)
Create a dispatcher using HTTP basic authentication using the supplied username and password.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
decodeResponse(java.io.InputStream response)
Decodes a response stream into a string
|
java.lang.String |
dispatchRequest(java.lang.String input)
Dispatch an encoded request to the system and await some response.
|
java.net.URL |
getEndpoint()
Getter for property 'endpoint'.
|
int |
getPort()
Returns the port associated with the endpoint
|
java.lang.String |
getVersion()
Provide a version of the service
|
protected void |
prepareConnection(javax.net.ssl.HttpsURLConnection connection)
Constructs a HTTPS POST connection
|
void |
setConnectionTimeout(int timeInMilliseconds)
Sets the time to attempt to connect to a cluster.
|
void |
setReadTimeout(int timeInMilliseconds)
Sets the time to attempt to read data from a request to a cluster.
|
void |
setTimeoutToDefault()
Sets the time to attempt to connect to a cluster and the time
to attempt to read data from a request to a cluster to the default settings.
|
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
public HttpsRequestDispatcher(java.net.URL endpoint)
public HttpsRequestDispatcher(java.net.URL endpoint,
java.lang.String username,
java.lang.String password)
endpoint - the hostname or IP address of the connectionusername - username credentialpassword - password credentialpublic java.lang.String getVersion()
VersionablegetVersion in interface Versionablepublic java.lang.String dispatchRequest(java.lang.String input)
throws java.io.IOException,
ApiConnectionException
dispatchRequest in interface RequestDispatcherinput - The input string to send to the remote server.java.io.IOException - if anything went wrong on the connection side of things.ApiConnectionExceptionprotected void prepareConnection(javax.net.ssl.HttpsURLConnection connection)
connection - the https connection to a Element OS clusterprotected java.lang.String decodeResponse(java.io.InputStream response)
throws java.io.IOException
response - the response as a streamjava.io.IOExceptionpublic void setTimeoutToDefault()
setTimeoutToDefault in interface RequestDispatcherpublic int getPort()
RequestDispatchergetPort in interface RequestDispatcherpublic void setConnectionTimeout(int timeInMilliseconds)
setConnectionTimeout in interface RequestDispatchertimeInMilliseconds - an int that specifies the timeout
value to be used in millisecondspublic void setReadTimeout(int timeInMilliseconds)
setReadTimeout in interface RequestDispatchertimeInMilliseconds - an int that specifies the timeout
value to be used in millisecondspublic java.net.URL getEndpoint()