org.gsm.oneapi.foundation
Class JSONRequest<T>
java.lang.Object
org.gsm.oneapi.foundation.JSONRequest<T>
public class JSONRequest<T>
- extends java.lang.Object
Handle the sending of a request to the OneAPI server, and decode the JSON response putting the result into the specified object type
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSONRequest
public JSONRequest(T initial)
getResponse
public T getResponse(java.net.HttpURLConnection con,
int requiredStatus)
getResponse
public T getResponse(java.net.HttpURLConnection con,
org.codehaus.jackson.map.ObjectMapper customMapper)
setupConnection
public static java.net.HttpURLConnection setupConnection(java.lang.String url,
java.lang.String authHeaderValue)
throws java.net.MalformedURLException,
java.io.IOException
- Throws:
java.net.MalformedURLException
java.io.IOException
setupConnectionWithCustomAuthorization
public static java.net.HttpURLConnection setupConnectionWithCustomAuthorization(java.lang.String url,
java.lang.String authorizationScheme,
java.lang.String authHeaderValue)
throws java.net.MalformedURLException,
java.io.IOException
- Throws:
java.net.MalformedURLException
java.io.IOException
formEncodeParams
public static java.lang.String formEncodeParams(FormParameters formParameters)
throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
formEncodeLineSeparaterParams
public static java.lang.String formEncodeLineSeparaterParams(FormParameters formParameters)
throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
getAuthorisationHeader
public static java.lang.String getAuthorisationHeader(java.lang.String username,
java.lang.String password)
base64Encode
public static java.lang.String base64Encode(java.lang.String s)
base64Decode
public static java.lang.String base64Decode(java.lang.String n)
dumpRequestVariables
public static void dumpRequestVariables(java.lang.String url,
java.lang.String authorisationHeader,
FormParameters formParameters)
urlEncode
public static java.lang.String urlEncode(java.lang.String s)