public class PayloadUtils extends Object
| Constructor and Description |
|---|
PayloadUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isContentTypeApplicationJson(Map<String,String> headers)
Checks whether the headers define the content type to be JSON.
|
static boolean |
isContentTypeApplicationXml(Map<String,String> headers)
Checks whether the headers define the content type to be XML.
|
static String |
prettyPrintRequestPayload(Object payload,
Map<String,String> headers)
Attempts to pretty print the payload of an
HTTP request based on the headers.
|
static String |
prettyPrintResponsePayload(String payload,
Map<String,String> headers)
Attempts to pretty print the payload of an
HTTP response based on the headers.
|
public static String prettyPrintRequestPayload(Object payload, Map<String,String> headers) throws IOException
payload - Payload to be serialized in the requestheaders - Headers, should contain "Content-Type"IOException - If something went wrong when serializing the objectpublic static String prettyPrintResponsePayload(String payload, Map<String,String> headers) throws IOException
payload - Payload to be pretty printedheaders - Headers, should contain "Content-Type"IOException - If something went wrong when (de)serializingpublic static boolean isContentTypeApplicationJson(Map<String,String> headers)
headers - Headers of a request or responseCopyright © 2015. All Rights Reserved.