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, setTitle
public static final java.lang.String RESPONSE_CONTENT_TYPE
public void onChange(java.lang.String type, java.lang.String... arguments)
PostResponse
type
with arguments.type
- The type of the modificationarguments
- The arguments to the modificationspublic void setError(java.lang.Throwable error)
PostResponse
setError
in interface PostResponse
setError
in class AbstractPostResponse
public java.lang.Throwable getError()
AbstractPostResponse
null
getError
in interface PostResponse
getError
in class AbstractPostResponse
null
public void setProperty(java.lang.String name, java.lang.Object value)
setProperty
in class AbstractPostResponse
name
- 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)
AbstractPostResponse
null
if no such property exists.getProperty
in class AbstractPostResponse
protected void doSend(javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doSend
in class AbstractPostResponse
java.io.IOException
Copyright © 2018 The Apache Software Foundation. All rights reserved.