public class JSONResource extends AbstractResource
Resty.Option, Resty.Timeout
inputStream, urlConnection
DEFAULT_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, stream
addAdditionalHeaders, 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, withHeader
public JSONResource(Resty.Option... options)
public JSONArray array() throws IOException, JSONException
IOException
JSONException
public Object get(JSONPathQuery aQuery) throws Exception
Exception
public Object get(String path) throws Exception
Exception
public String getAcceptedTypes()
getAcceptedTypes
in class AbstractResource
public JSONResource json(JSONPathQuery path) throws Exception
path
- path to the URI to followException
JSONException
public JSONResource json(JSONPathQuery path, Content content) throws Exception
path
- path to the URI to followException
JSONException
public JSONObject object() throws IOException, JSONException
IOException
JSONException
public TextResource text(JSONPathQuery path) throws Exception
path
- path to the URI to followException
JSONException
public JSONObject toObject() throws IOException, JSONException
IOException
JSONException
- if data was no valid JSONprotected Object unmarshal() throws IOException, JSONException
IOException
JSONException