public final class JsonRenderer extends AbstractResponseRenderer
| Constructor and Description |
|---|
JsonRenderer() |
| Modifier and Type | Method and Description |
|---|---|
JSONObject |
getJSONObject()
Gets the json object to render.
|
boolean |
isJSONP()
Determines whether render as JSONP.
|
boolean |
isPretty()
Determins whether pretty rendering.
|
void |
render(RequestContext context)
Renders with the specified HTTP request context.
|
void |
setCallback(String callback)
Sets JSONP callback function.
|
void |
setJSONObject(JSONObject jsonObject)
Sets the json object to render with the specified json object.
|
JsonRenderer |
setJSONP(boolean isJSONP)
Sets whether render as JSONP.
|
void |
setPretty(boolean pretty)
Sets whether pretty rendering.
|
getRenderDataModel, postRender, preRender, setRendererIdpublic boolean isPretty()
true for pretty rendering, returns false otherwisepublic void setPretty(boolean pretty)
pretty - true for pretty rendering, false otherwisepublic JSONObject getJSONObject()
public void setJSONObject(JSONObject jsonObject)
jsonObject - the specified json objectpublic boolean isJSONP()
true for JSONP, false otherwisepublic JsonRenderer setJSONP(boolean isJSONP)
isJSONP - true for JSONP, false otherwisepublic void setCallback(String callback)
Invokes this method will set isJSONP() to true
automatically.
callback - the specified callback function namepublic void render(RequestContext context)
ResponseRendererrender in interface ResponseRendererrender in class AbstractResponseRenderercontext - the specified HTTP request contextCopyright © 2009–2019 B3log. All rights reserved.