public final class Tools
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static org.apache.http.impl.client.CloseableHttpClient |
buildHttpClient()
Returns a closeable HTTP(S) client.
|
static java.lang.String |
cloak(java.lang.String text)
Returns the URL encoded
text . |
static void |
closeHttpClient(org.apache.http.impl.client.CloseableHttpClient client)
Closes the provided HTTP client.
|
static org.apache.http.client.methods.HttpUriRequest |
createHttpPostRequest(java.lang.String methodURL,
java.lang.String dataPart)
Build a HTTP POST request which can be sent to server side.
|
static org.apache.axiom.om.OMElement |
getAlliesResponseElement(org.apache.http.HttpResponse httpResponse)
Retruns the PDR-Allies response Element from incoming HTTP response.
|
static java.lang.String |
readInputStream(java.io.InputStream inputStream)
Reads the provided input stream and returns its content as
java.lang.String . |
static void |
setAxis2Base(java.net.URL url)
Sets Axis2 base URL.
|
static java.lang.String |
uncloak(java.lang.String text)
Returns the URL decoded
text . |
public static java.lang.String uncloak(java.lang.String text)
text
.text
- Text to be decoded.public static java.lang.String cloak(java.lang.String text)
text
.text
- Text to be encoded.public static org.apache.http.impl.client.CloseableHttpClient buildHttpClient() throws PDRAlliesClientException
PDRAlliesClientException
- Could not create HTTP client.public static void closeHttpClient(org.apache.http.impl.client.CloseableHttpClient client)
client
- Closeable HTTP client.public static org.apache.http.client.methods.HttpUriRequest createHttpPostRequest(java.lang.String methodURL, java.lang.String dataPart)
methodURL
- Complete URL of the used method.dataPart
- Data part of the request.public static org.apache.axiom.om.OMElement getAlliesResponseElement(org.apache.http.HttpResponse httpResponse) throws PDRAlliesClientException
httpResponse
- Incoming HTTP response.PDRAlliesClientException
- Could not get response element.public static java.lang.String readInputStream(java.io.InputStream inputStream) throws java.io.IOException
java.lang.String
.inputStream
- Input stream to read.java.io.IOException
- Could not read input stream.public static void setAxis2Base(java.net.URL url)
url
- Axis2 base URL.