|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectus.monoid.web.Resty
us.monoid.web.AbstractResource
us.monoid.web.JSONResource
public class JSONResource
A resource presentation in JSON format. You can ask Resty to parse the JSON into a JSONArray or a JSONObject. The JSONObject is similar to org.json.JSONObject and allows full access to the JSON. You can also access the JSON with a JSONPathQuery to extract only the parts you are interested in.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class us.monoid.web.Resty |
|---|
Resty.Option, Resty.Proxy, Resty.Timeout |
| Constructor Summary | |
|---|---|
JSONResource(Resty.Option... options)
|
|
| Method Summary | |
|---|---|
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. |
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. |
XMLResource |
xml(JSONPathQuery path)
Execute the given path query on the json and GET the returned URI expecting text/* |
XMLResource |
xml(JSONPathQuery path,
Content content)
Execute the given path query on the json and POST to the returned URI expecting text/* |
| Methods inherited from class us.monoid.web.AbstractResource |
|---|
getUrlConnection, http, location, status, stream |
| Methods inherited from class us.monoid.web.Resty |
|---|
alwaysSend, authenticate, authenticate, authenticateForRealm, bytes, bytes, bytes, bytes, content, content, content, data, data, delete, dontSend, enc, form, form, identifyAsMozilla, identifyAsResty, ignoreAllCerts, json, json, json, json, path, put, setOptions, setProxy, text, text, text, text, withHeader, xml, xml, xml, xml, xpath |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JSONResource(Resty.Option... options)
| Method Detail |
|---|
public JSONArray array()
throws IOException,
JSONException
IOException
JSONException
public JSONObject object()
throws IOException,
JSONException
IOException
JSONException
public JSONObject toObject()
throws IOException,
JSONException
IOException
JSONException - if data was no valid JSON
public JSONResource json(JSONPathQuery path)
throws Exception
path - path to the URI to follow
Exception
JSONException
public JSONResource json(JSONPathQuery path,
Content content)
throws Exception
path - path to the URI to follow
Exception
JSONException
public TextResource text(JSONPathQuery path)
throws Exception
path - path to the URI to follow
Exception
JSONException
public XMLResource xml(JSONPathQuery path)
throws Exception
path - path to the URI to follow
Exception
public XMLResource xml(JSONPathQuery path,
Content content)
throws Exception
path - path to the URI to follow
Exception
public Object get(String path)
throws Exception
Exception
public Object get(JSONPathQuery aQuery)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||