|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.alfresco.bm.json.JSONUtil
public class JSONUtil
Utilities for JSON-parsing.
| Field Summary | |
|---|---|
static String |
FORM_PROCESSOR_JSON_PERSISTED_OBJECT
|
static String |
HEADER_ACCEPT
|
static String |
HEADER_CONTENT_TYPE
|
static String |
JSON_DATA
|
static String |
JSON_ID
|
static String |
JSON_ITEMS
|
static String |
JSON_NAME
|
static String |
MIME_TYPE_JSON
|
| Constructor Summary | |
|---|---|
JSONUtil()
|
|
| Method Summary | |
|---|---|
static org.json.simple.JSONArray |
getArray(org.json.simple.JSONObject json,
String key)
|
static org.json.simple.JSONArray |
getDataArrayFromResponse(org.apache.commons.httpclient.HttpMethod method)
Extract the "data" JSON-array from the method's response. |
static org.json.simple.JSONObject |
getDataFromResponse(org.apache.commons.httpclient.HttpMethod method)
Extract the "data" JSON-object from the method's response. |
static org.json.simple.JSONObject |
getObject(org.json.simple.JSONObject json,
String key)
|
static org.json.simple.JSONObject |
getObjectFromResponse(org.apache.commons.httpclient.HttpMethod method)
Extract JSON-object from the method's response. |
static String |
getString(org.json.simple.JSONObject json,
String key,
String defaultValue)
Gets a string-value from the given JSON-object for the given key. |
static void |
populateRequestBody(org.apache.commons.httpclient.methods.EntityEnclosingMethod method,
org.json.simple.JSONObject object)
Adds the JSON as request-body the the method and sets the correct content-type. |
static void |
setJSONExpected(org.apache.commons.httpclient.HttpMethod method)
Sets a header to notify server we expect a JSON-repsponse for this method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String JSON_DATA
public static final String JSON_ID
public static final String JSON_ITEMS
public static final String JSON_NAME
public static final String FORM_PROCESSOR_JSON_PERSISTED_OBJECT
public static final String MIME_TYPE_JSON
public static final String HEADER_ACCEPT
public static final String HEADER_CONTENT_TYPE
| Constructor Detail |
|---|
public JSONUtil()
| Method Detail |
|---|
public static void setJSONExpected(org.apache.commons.httpclient.HttpMethod method)
method -
public static void populateRequestBody(org.apache.commons.httpclient.methods.EntityEnclosingMethod method,
org.json.simple.JSONObject object)
method - object - public static org.json.simple.JSONObject getDataFromResponse(org.apache.commons.httpclient.HttpMethod method)
method - the method containing the response
public static org.json.simple.JSONArray getDataArrayFromResponse(org.apache.commons.httpclient.HttpMethod method)
method - the method containing the response
public static org.json.simple.JSONObject getObjectFromResponse(org.apache.commons.httpclient.HttpMethod method)
method - the method containing the response
public static String getString(org.json.simple.JSONObject json,
String key,
String defaultValue)
json - the json objectkey - key pointing to the valuedefaultValue - if value is not set or if value is not of type "String", this value is returned
public static org.json.simple.JSONArray getArray(org.json.simple.JSONObject json,
String key)
json - JSON to extract array fromkey - key under which array is present on JSON
JSONArray. Returns null, if the value is null or not an array.
public static org.json.simple.JSONObject getObject(org.json.simple.JSONObject json,
String key)
json - JSON to extract object fromkey - key under which object is present on JSON
JSONObject. Returns null, if the value is null or not an object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||