com.smartgwt.client.rpc
Class RPCResponse

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.rpc.RPCResponse
Direct Known Subclasses:
DSResponse

public class RPCResponse
extends DataClass

Encapsulates an RPC response from the server. Instances of this class are automatically created and optionally passed to you in the callback you specify as part of your RPCRequest.


Field Summary
static int STATUS_FAILURE
           
static int STATUS_LOGIN_INCORRECT
           
static int STATUS_LOGIN_REQUIRED
           
static int STATUS_LOGIN_SUCCESS
           
static int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED
           
static int STATUS_SERVER_TIMEOUT
           
static int STATUS_SUCCESS
           
static int STATUS_TRANSPORT_ERROR
           
static int STATUS_VALIDATION_ERROR
           
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
RPCResponse()
           
RPCResponse(JavaScriptObject jsObj)
           
 
Method Summary
 Integer getHttpResponseCode()
          This attribute (avialable when using the the xmlHttpRequest transport) contains the HTTP response code sent by the server.
static RPCResponse getOrCreateRef(JavaScriptObject jsObj)
           
 int getStatus()
          Status code for this response.
 Integer getTransactionNum()
          ID of the transaction sent to the server via RPCManager.sendQueue() containing the RPCRequest associated with this response.
 void setStatus(int status)
          Status code for this response.
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_FAILURE

public static int STATUS_FAILURE

STATUS_LOGIN_INCORRECT

public static int STATUS_LOGIN_INCORRECT

STATUS_LOGIN_REQUIRED

public static int STATUS_LOGIN_REQUIRED

STATUS_LOGIN_SUCCESS

public static int STATUS_LOGIN_SUCCESS

STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED

public static int STATUS_MAX_LOGIN_ATTEMPTS_EXCEEDED

STATUS_SERVER_TIMEOUT

public static int STATUS_SERVER_TIMEOUT

STATUS_SUCCESS

public static int STATUS_SUCCESS

STATUS_TRANSPORT_ERROR

public static int STATUS_TRANSPORT_ERROR

STATUS_VALIDATION_ERROR

public static int STATUS_VALIDATION_ERROR
Constructor Detail

RPCResponse

public RPCResponse()

RPCResponse

public RPCResponse(JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static RPCResponse getOrCreateRef(JavaScriptObject jsObj)

getStatus

public int getStatus()
Status code for this response. Status codes less than zero are considered errors by the RPCManager, those greater than or equal to zero are considered successes. Please see the error handling section the RPCManager for more information on what the RPCManager does with the status code and how you can override this behavior.

When using the Smart GWT server you can set the rpcResponse.status by calling the server-side method RPCResponse.setStatus().

When not using the Smart GWT server, the RPCManager makes no assumptions about the structure of the response, so the status code just reflects the httpResponseCode: status will be STATUS_TRANSPORT_ERROR if an HTTP-level error occurred such as "500 server error". If you have a status code you need to transmit you can simply embed it in the response (as part of data) and interpret it from the callback.

With or without the Smart GWT server, the Relogin status codes (such as STATUS_LOGIN_REQUIRED) are triggered whenever special markers, such as the loginRequiredMarker, appear in the body of the response. See the 'Relogin Overview' for details.

Returns:
int

getHttpResponseCode

public Integer getHttpResponseCode()
This attribute (avialable when using the the xmlHttpRequest transport) contains the HTTP response code sent by the server.

Note that this is different from status - that attribute is used to indicate a status code for the RPC itself whereas httpResponseCode is the raw HTTP response code for the HTTP request that contained the RPCRequest.

This feature relies on the XMLHttpRequest object which can be disabled by end-users in some supported browsers. See PlatformDependencies for more information.

If you're using this attribute, you'll typically want to avoid the default error handling response of RPCManager. To do so, set willHandleError to true.

Returns:
Integer

getTransactionNum

public Integer getTransactionNum()
ID of the transaction sent to the server via RPCManager.sendQueue() containing the RPCRequest associated with this response.

Returns:
Integer

setStatus

public void setStatus(int status)
Status code for this response. Status codes less than zero are considered errors by the RPCManager, those greater than or equal to zero are considered successes. Please see the error handling section the RPCManager for more information on what the RPCManager does with the status code and how you can override this behavior.

When using the Smart GWT server you can set the rpcResponse.status by calling the server-side method RPCResponse.setStatus().

When not using the Smart GWT server, the RPCManager makes no assumptions about the structure of the response, so the status code just reflects the httpResponseCode: status will be STATUS_TRANSPORT_ERROR if an HTTP-level error occurred such as "500 server error". If you have a status code you need to transmit you can simply embed it in the response (as part of data) and interpret it from the callback.

With or without the Smart GWT server, the Relogin Overview for details.

Parameters:
status - status