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 client which is HTTPS enabled.
|
static void |
checkAuthorization(org.apache.axiom.om.OMElement inElement)
Looks for authentication information in the provided element, and checks if
the user is known.
|
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.axiom.om.OMElement |
createResponseElement(java.lang.String elementName)
Creates an element for use in Allies responses.
|
static org.apache.axiom.om.OMElement |
createResponseRootElement(java.lang.String elementName)
Creates the root element of a Allies response.
|
static org.apache.axiom.om.OMElement |
getAlliesResponseElement(org.apache.http.HttpResponse httpResponse)
Returns root element of PDR-Allies response element form provided 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 java.lang.String |
uncloak(java.lang.String text)
Returns the URL decoded
text . |
public static java.lang.String cloak(java.lang.String text)
text
.text
- Text to be encoded.public static java.lang.String uncloak(java.lang.String text)
text
.text
- Text to be decoded.public static org.apache.axiom.om.OMElement createResponseRootElement(java.lang.String elementName)
elementName
- Name of the root element.public static org.apache.axiom.om.OMElement createResponseElement(java.lang.String elementName)
elementName
- Name of the element.public static org.apache.axiom.om.OMElement getAlliesResponseElement(org.apache.http.HttpResponse httpResponse) throws PDRAlliesClientException
httpResponse
- HTTP response from server side.PDRAlliesClientException
- Could not get content of PDR-Allies response.public static org.apache.http.impl.client.CloseableHttpClient buildHttpClient() throws java.lang.Exception
java.lang.Exception
- Could not create HTTP client.public static void closeHttpClient(org.apache.http.impl.client.CloseableHttpClient client)
client
- HTTP client to be closed.public static void checkAuthorization(org.apache.axiom.om.OMElement inElement) throws org.apache.axis2.AxisFault
inElement
- Element whoch contains authentication information.org.apache.axis2.AxisFault
- Unknown user, or authentication error.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.