public class RPCResponse extends BaseResponse
RPCManager, RPCRequest, JSTranslaterSTATUS_AUTHORIZATION_FAILURE, STATUS_FAILURE, STATUS_FILE_NOT_FOUND, STATUS_FILE_REQUIRED_ERROR, STATUS_LOGIN_INCORRECT, STATUS_LOGIN_REQUIRED, STATUS_LOGIN_SUCCESS, STATUS_MAX_FILE_SIZE_EXCEEDED, STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED, STATUS_PROCESSING_SKIPPED, STATUS_SUCCESS, STATUS_TRANSACTION_FAILED, STATUS_UPDATE_WITHOUT_PK, STATUS_VALIDATION_ERROR, UPDATE_WITHOUT_PK| Constructor and Description |
|---|
RPCResponse() Creates an empty RPCResponse. |
RPCResponse(java.lang.Object data) Creates an RPCResponse with the provided data payload. Note: the status of this response is automatically set to the success code (RPCResponse.STATUS_SUCCESS) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object | getData() Retrives the data previosly set via setData() or the constructor that takes the data argument. |
int | getStatus() Retrieves the currently set status code for this response. |
RPCResponse | setData(java.lang.Object data) Sets the response payload to be delivered to the client. |
RPCResponse | setStatus(int status) Sets the status of this response. |
setFailure, setSuccess, statusIsError, statusIsSuccesspublic RPCResponse()
Note: the status of this response is automatically set to the success code (RPCResponse.STATUS_SUCCESS); response is set to a success code (0)
public RPCResponse(java.lang.Object data)
data - the data you wish to send back.RPCResponse.setData(Object)public java.lang.Object getData()
getData in class BaseResponsepublic RPCResponse setData(java.lang.Object data)
The object passed to setData() is translated to JavaScript via the JSTranslater class. Virtually anything passed to setData() will make it back to the browser in some reasonable representation; see JSTranslater for full documentation.
You may call setData() any number of times, only the last provided value will be the value sent to the client.
setData in class BaseResponsedata - the data you wish to send back.JSTranslater.toJS(Object, Writer), JSONFilterpublic RPCResponse setStatus(int status)
Negative values will trigger error handling code on the client side - see the client-side reference for RPCManager.handleError(), rpcRequest.willHandleError.
The default client-side behavior for a negative status code is that, if the data sent back (via setData()) is a String, it will be shown to the user in a warning dialog.
setStatus in class BaseResponsestatus - the status code for this responsepublic int getStatus()
getStatus in class BaseResponse