|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.netheos.pcsapi.utils.PcsUtils
public final class PcsUtils
Utility class for the project
| Field Summary | |
|---|---|
static boolean |
ANDROID
|
static Charset |
UTF8
|
| Method Summary | |
|---|---|
static String |
abbreviate(String source,
int maxLen)
Abbreviate a string if longer than maxLen. |
static CStorageException |
buildCStorageException(CResponse response,
String message,
CPath path)
Some common code between providers. |
static void |
closeQuietly(Closeable c)
|
static void |
downloadDataToSink(CResponse response,
ByteSink byteSink)
Server has answered OK with a file to download as stream. |
static void |
ensureContentTypeIsJson(CResponse response,
boolean isRetriable)
Extract content type from response headers, and ensure it is application/json or text/javascript. |
static void |
ensureContentTypeIsXml(CResponse response,
boolean isRetriable)
Extract content type from response headers, and ensure it is application/xml. |
static String |
randomString(char[] values,
int len)
Generate a random String |
static String |
randomString(int len)
Generate a random String |
static void |
releaseHttpClient(org.apache.http.client.HttpClient httpClient)
|
static String |
shortenUrl(URI uri)
Removes query parameters from url (only for logging, as query parameters may contain sensible informations) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Charset UTF8
public static final boolean ANDROID
| Method Detail |
|---|
public static void ensureContentTypeIsJson(CResponse response,
boolean isRetriable)
throws CStorageException
response - the response to checkisRetriable - if True, raised exception is wrapped into a CRetriable
CStorageException
public static void ensureContentTypeIsXml(CResponse response,
boolean isRetriable)
throws CStorageException
response - the response to checkisRetriable - if True, raised exception is wrapped into a CRetriable
CStorageException
public static CStorageException buildCStorageException(CResponse response,
String message,
CPath path)
response - The wrapped HTTP responsemessage - The error message (provided by the server or by the application)path - The file requested (which failed)
public static String shortenUrl(URI uri)
uri -
public static String abbreviate(String source,
int maxLen)
source - may be nullmaxLen - must be >= 0. Up to this length, string is not truncated; otherwise truncated to maxLen and
three dots as allipsis are added.
public static void downloadDataToSink(CResponse response,
ByteSink byteSink)
response - server response to read frombyteSink - destinationpublic static void closeQuietly(Closeable c)
public static String randomString(int len)
len - The number of characters in the output String
public static String randomString(char[] values,
int len)
values - The characters list to use in the randomizationlen - The number of characters in the output String
public static void releaseHttpClient(org.apache.http.client.HttpClient httpClient)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||