public class JSONResponse extends AbstractPostResponse
JSONResponse is an AbstractPostResponse preparing
the response in JSON.| Modifier and Type | Class and Description |
|---|---|
class |
JSONResponse.JSONResponseException |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
RESPONSE_CONTENT_TYPE |
PN_ERROR, PN_IS_CREATED, PN_LOCATION, PN_PARENT_LOCATION, PN_PATH, PN_REFERER, PN_STATUS_CODE, PN_STATUS_MESSAGE, PN_TITLE| Constructor and Description |
|---|
JSONResponse() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doSend(javax.servlet.http.HttpServletResponse response) |
java.lang.Throwable |
getError()
Returns any recorded error or
null |
java.lang.Object |
getProperty(java.lang.String name)
Returns the generic response property with the given name and type or
null if no such property exists. |
void |
onChange(java.lang.String type,
java.lang.String... arguments)
Records a generic change of the given
type with arguments. |
void |
setError(java.lang.Throwable error)
Sets the recorded error causing the operation to fail.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
This method accepts values that correspond to json primitives or otherwise assumes that the toString() of the value
can be parsed as json.
|
getLocation, getParentLocation, getPath, getProperty, getReferer, getStatusCode, getStatusMessage, isCreateRequest, isSafeReferer, isSuccessful, onCopied, onCreated, onDeleted, onModified, onMoved, send, setCreateRequest, setLocation, setParentLocation, setPath, setReferer, setStatus, setTitlepublic static final java.lang.String RESPONSE_CONTENT_TYPE
public void onChange(java.lang.String type,
java.lang.String... arguments)
PostResponsetype with arguments.type - The type of the modificationarguments - The arguments to the modificationspublic void setError(java.lang.Throwable error)
PostResponsesetError in interface PostResponsesetError in class AbstractPostResponsepublic java.lang.Throwable getError()
AbstractPostResponsenullgetError in interface PostResponsegetError in class AbstractPostResponsenullpublic void setProperty(java.lang.String name,
java.lang.Object value)
setProperty in class AbstractPostResponsename - name of the propertyvalue - value of the property - either of type {String, Boolean, Number, null}
or the toString() is parseable as jsonJSONResponse.JSONResponseException - if the value is not usablepublic java.lang.Object getProperty(java.lang.String name)
AbstractPostResponsenull if no such property exists.getProperty in class AbstractPostResponseprotected void doSend(javax.servlet.http.HttpServletResponse response)
throws java.io.IOException
doSend in class AbstractPostResponsejava.io.IOExceptionCopyright © 2018 The Apache Software Foundation. All rights reserved.