public abstract class BaseResponse extends Base
DSResponse
and RPCResponse
extend this class in order to function as expected in DataSources as well as other request processing. This class was introduced together with DSTransaction
in order to ease the relationships between the request/response classes and the transaction layer.BaseRequest
Modifier and Type | Field and Description |
---|---|
static int | STATUS_AUTHORIZATION_FAILURE Indicates that a authorization attempt failed. |
static int | STATUS_FAILURE Indicates a failure of some sort (generic). |
static int | STATUS_FILE_NOT_FOUND Indicates that a file has not been found. |
static int | STATUS_FILE_REQUIRED_ERROR Indicates that a file has not been specified. |
static int | STATUS_LOGIN_INCORRECT Indicates that a login attempt failed. |
static int | STATUS_LOGIN_REQUIRED Indicates that login is required. |
static int | STATUS_LOGIN_SUCCESS Indicates that a login attempt failed. |
static int | STATUS_MAX_FILE_SIZE_EXCEEDED Indicates that a maximum file size was exceeded for the request. |
static int | STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED Indicates that the maximum number of login attempts have been exceeded. |
static int | STATUS_PROCESSING_SKIPPED Indicates that request processing was skipped. |
static int | STATUS_SUCCESS Indicates successful completion of the request. |
static int | STATUS_TRANSACTION_FAILED Indicates a failure during a transactional request. |
static int | STATUS_UPDATE_WITHOUT_PK Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued. |
static int | STATUS_VALIDATION_ERROR Indicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors(). |
static int | UPDATE_WITHOUT_PK Deprecated. Use BaseResponse.STATUS_UPDATE_WITHOUT_PK instead for naming consistency. |
Modifier and Type | Method and Description |
---|---|
int | getStatus() Retrieves the currently set status code for this response. |
BaseResponse | setFailure() Sets the status code to BaseResponse.STATUS_FAILURE . |
BaseResponse | setStatus(int status) Sets the status of this response. |
BaseResponse | setSuccess() Sets the status of this DSResponse to STATUS_SUCCESS. |
boolean | statusIsError() Returns true unless the currently status is STATUS_SUCCESS |
boolean | statusIsSuccess() |
public static final int STATUS_SUCCESS
public static final int STATUS_FILE_NOT_FOUND
public static final int STATUS_AUTHORIZATION_FAILURE
public static final int STATUS_FAILURE
See the error handling doc section in RPCManager for information on how the client handles errors.
public static final int STATUS_VALIDATION_ERROR
This error code will automatically be set for you if you call setErrors() or addError().
To instead indicate an unrecoverable error that does not have per-field error messages, set STATUS_FAILURE.
public static final int STATUS_PROCESSING_SKIPPED
public static final int STATUS_LOGIN_INCORRECT
public static final int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED
public static final int STATUS_LOGIN_REQUIRED
public static final int STATUS_LOGIN_SUCCESS
@Deprecated public static final int UPDATE_WITHOUT_PK
BaseResponse.STATUS_UPDATE_WITHOUT_PK
instead for naming consistency.public static final int STATUS_UPDATE_WITHOUT_PK
public static final int STATUS_TRANSACTION_FAILED
public static final int STATUS_MAX_FILE_SIZE_EXCEEDED
public static final int STATUS_FILE_REQUIRED_ERROR
public int getStatus()
public BaseResponse 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.
status
- the status code for this responsepublic boolean statusIsError()
public boolean statusIsSuccess()
public BaseResponse setSuccess()
public BaseResponse setFailure()
BaseResponse.STATUS_FAILURE
.