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 |
---|---|
org.json.me.JSONArray |
array()
Parse and return JSON array.
|
java.lang.Object |
get(JSONPathQuery aQuery)
Gets the partial JSON object or attribute as specified in the path expression.
|
java.lang.Object |
get(java.lang.String path)
Gets the partial JSON object or attribute as specified in the path expression.
|
java.lang.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
|
org.json.me.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/*
|
org.json.me.JSONObject |
toObject()
Added for compatibility with Scala.
|
protected java.lang.Object |
unmarshal()
Transforming the JSON
|
getUrlConnection, http, location, printResponseHeaders, status, stream
addAdditionalHeaders, addStandardHeaders, alwaysSend, 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 org.json.me.JSONArray array() throws java.io.IOException, org.json.me.JSONException
java.io.IOException
org.json.me.JSONException
public org.json.me.JSONObject object() throws java.io.IOException, org.json.me.JSONException
java.io.IOException
org.json.me.JSONException
public org.json.me.JSONObject toObject() throws java.io.IOException, org.json.me.JSONException
java.io.IOException
org.json.me.JSONException
- if data was no valid JSONprotected java.lang.Object unmarshal() throws java.io.IOException, org.json.me.JSONException
java.io.IOException
org.json.me.JSONException
public JSONResource json(JSONPathQuery path) throws java.lang.Exception
path
- path to the URI to followjava.lang.Exception
org.json.me.JSONException
public JSONResource json(JSONPathQuery path, Content content) throws java.lang.Exception
path
- path to the URI to followjava.lang.Exception
org.json.me.JSONException
public TextResource text(JSONPathQuery path) throws java.lang.Exception
path
- path to the URI to followjava.lang.Exception
org.json.me.JSONException
public java.lang.Object get(java.lang.String path) throws java.lang.Exception
java.lang.Exception
public java.lang.Object get(JSONPathQuery aQuery) throws java.lang.Exception
java.lang.Exception
public java.lang.String getAcceptedTypes()
getAcceptedTypes
in class AbstractResource