Package com.isomorphic.rpc
Class BaseResponse<T extends BaseResponse>
java.lang.Object
com.isomorphic.base.Base
com.isomorphic.rpc.BaseResponse<T>
- All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
- Direct Known Subclasses:
DSResponse
,RPCResponse
public abstract class BaseResponse<T extends BaseResponse> extends com.isomorphic.base.Base
This is the base for all responses going through the rpc and DataSource layer in Smartclient Server. Both
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Indicates that a authorization attempt failed.static final int
Indicates a failure of some sort (generic).static final int
Indicates that a file has not been found.static final int
Indicates that a file has not been specified.static final int
Indicates that a login attempt failed.static final int
Indicates that login is required.static final int
Indicates that a login attempt failed.static final int
Indicates that a maximum file size was exceeded for the request.static final int
Indicates that the maximum number of login attempts have been exceeded.static final int
Indicates that request processing was skipped.static final int
Indicates that an operation binding configured to require requiredCriterion has received none.static final int
Indicates successful completion of the request.static final int
Indicates a failure during a transactional request.static final int
Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued.static final int
Indicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors().static final int
Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionint
Retrieves the currently set status code for this response.Sets the status code toSTATUS_FAILURE
.setStatus
(int status) Sets the status of this response.Sets the status of this DSResponse to STATUS_SUCCESS.boolean
Returns true unless the currently status is STATUS_SUCCESSboolean
-
Field Details
-
STATUS_SUCCESS
public static final int STATUS_SUCCESSIndicates successful completion of the request. This is the default status and is automatically used by the RPCResponse unless you override it with setStatus().- See Also:
-
STATUS_FILE_NOT_FOUND
public static final int STATUS_FILE_NOT_FOUNDIndicates that a file has not been found.- See Also:
-
STATUS_AUTHORIZATION_FAILURE
public static final int STATUS_AUTHORIZATION_FAILUREIndicates that a authorization attempt failed.- See Also:
-
STATUS_FAILURE
public static final int STATUS_FAILUREIndicates a failure of some sort (generic).See the error handling doc section in RPCManager for information on how the client handles errors.
- See Also:
-
STATUS_VALIDATION_ERROR
public static final int STATUS_VALIDATION_ERRORIndicates a validation failure and should include errors associated with each invalid field, via addError() or setErrors(). If the request was initiated by a databound component, the returned errors will be displayed next to the fields.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.
- See Also:
-
STATUS_PROCESSING_SKIPPED
public static final int STATUS_PROCESSING_SKIPPEDIndicates that request processing was skipped. This is likely due to request processing being told to skip remaining requests in a transaction queue.- See Also:
-
STATUS_LOGIN_INCORRECT
public static final int STATUS_LOGIN_INCORRECTIndicates that a login attempt failed.- See Also:
-
STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED
public static final int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDEDIndicates that the maximum number of login attempts have been exceeded.- See Also:
-
STATUS_LOGIN_REQUIRED
public static final int STATUS_LOGIN_REQUIREDIndicates that login is required.- See Also:
-
STATUS_LOGIN_SUCCESS
public static final int STATUS_LOGIN_SUCCESSIndicates that a login attempt failed.- See Also:
-
UPDATE_WITHOUT_PK
Deprecated.UseSTATUS_UPDATE_WITHOUT_PK
instead for naming consistency.Indicates that an update request was made without there being a primary key set on the datasource for which the update was issued.- See Also:
-
STATUS_UPDATE_WITHOUT_PK
public static final int STATUS_UPDATE_WITHOUT_PKIndicates that an update request was made without there being a primary key set on the datasource for which the update was issued.- See Also:
-
STATUS_TRANSACTION_FAILED
public static final int STATUS_TRANSACTION_FAILEDIndicates a failure during a transactional request. This usually means that one of the requests involved in the transaction failed and you should have a look at that specific requests status code and error logs to determine why the whole transaction failed.- See Also:
-
STATUS_MAX_FILE_SIZE_EXCEEDED
public static final int STATUS_MAX_FILE_SIZE_EXCEEDEDIndicates that a maximum file size was exceeded for the request. This can happen if there is a maximum upload size specified and a file of larger size is sent through in the request.- See Also:
-
STATUS_REQUIRED_CRITERIA_MISSING
public static final int STATUS_REQUIRED_CRITERIA_MISSINGIndicates that an operation binding configured to require requiredCriterion has received none.- See Also:
-
STATUS_FILE_REQUIRED_ERROR
public static final int STATUS_FILE_REQUIRED_ERRORIndicates that a file has not been specified.- See Also:
-
-
Method Details
-
getStatus
public int getStatus()Retrieves the currently set status code for this response. -
setStatus
Sets the status of this response. A zero status indicates succeess, a negative value indicates failure.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.
- Parameters:
status
- the status code for this response- Returns:
- the RPCResponse
-
statusIsError
public boolean statusIsError()Returns true unless the currently status is STATUS_SUCCESS- Returns:
- false if status is STATUS_SUCCESS, false otherwise
-
statusIsSuccess
public boolean statusIsSuccess()- Returns:
- true if the currently set status code is STATUS_SUCCESS, false otherwise.
-
setSuccess
Sets the status of this DSResponse to STATUS_SUCCESS.- Returns:
- the DSResponse
-
setFailure
Sets the status code toSTATUS_FAILURE
.- Returns:
- the DSResponse
-
STATUS_UPDATE_WITHOUT_PK
instead for naming consistency.