public class JSONResource extends AbstractResource
Resty.Option, Resty.TimeoutinputStream, urlConnectionDEFAULT_USER_AGENT, MOZILLA, userAgent| Constructor and Description |
|---|
JSONResource(Resty.Option... options) |
| Modifier and Type | Method and Description |
|---|---|
JSONArray |
array()
Parse and return JSON array.
|
Object |
get(JSONPathQuery aQuery)
Gets the partial JSON object or attribute as specified in the path expression.
|
Object |
get(String path)
Gets the partial JSON object or attribute as specified in the path expression.
|
String |
getAcceptedTypes() |
JSONResource |
json(JSONPathQuery path)
Execute the given path query on the json GET the returned URI expecting JSON
|
JSONResource |
json(JSONPathQuery path,
Content content)
Execute the given path query on the json and POST to the returned URI expecting JSON
|
JSONObject |
object()
Parse and return JSON object.
|
TextResource |
text(JSONPathQuery path)
Execute the given path query on the json and use the returned string as an URI expecting text/*
|
JSONObject |
toObject()
Added for compatibility with Scala.
|
protected Object |
unmarshal()
Transforming the JSON
|
getUrlConnection, http, location, printResponseHeaders, status, streamaddAdditionalHeaders, addStandardHeaders, bytes, bytes, bytes, bytes, chunked, chunked, content, content, content, content, createBinaryResource, createJSONResource, createTextResource, data, data, delete, doGET, dontSend, doPOSTOrPUT, fillResourceFromURL, form, form, getAdditionalHeaders, identifyAsMozilla, identifyAsResty, json, json, json, json, openConnection, path, put, setOptions, text, text, text, text, withHeaderpublic JSONResource(Resty.Option... options)
public JSONArray array() throws IOException, JSONException
IOExceptionJSONExceptionpublic Object get(JSONPathQuery aQuery) throws Exception
Exceptionpublic Object get(String path) throws Exception
Exceptionpublic String getAcceptedTypes()
getAcceptedTypes in class AbstractResourcepublic JSONResource json(JSONPathQuery path) throws Exception
path - path to the URI to followExceptionJSONExceptionpublic JSONResource json(JSONPathQuery path, Content content) throws Exception
path - path to the URI to followExceptionJSONExceptionpublic JSONObject object() throws IOException, JSONException
IOExceptionJSONExceptionpublic TextResource text(JSONPathQuery path) throws Exception
path - path to the URI to followExceptionJSONExceptionpublic JSONObject toObject() throws IOException, JSONException
IOExceptionJSONException - if data was no valid JSONprotected Object unmarshal() throws IOException, JSONException
IOExceptionJSONException