com.mi.rs.Response Class Reference
Description
Defines the interface of a command response object. This interface is used by RSService in calls to command response handlers. it gives access to all the data available in a response to a RealityServer command.
Batch commands has complex responses containing the responses of all the batch sub-commands. To make parsing eaiser there are several batch command specific methods added to this interface. The result object will contain all the information needed, but the subResponses array contains all the sub-responses as Response objects. Note that sub-responses can also be responses to nested batch commands.
Constructor
- Response( com.mi.rs.Command command, Object serverResponse)
- Creates an Response object. More...
Member Functions
Variables
- com.mi.rs.Command command
- Returns the command this is the response to.
- Object error
- Contains information about the error, or null if no error occured. More...
- Boolean hasSubErrorResponse
- Returns true if any of the sub-responses is an error response. More...
- Boolean isBatchResponse
- True if this is the response to a batch command. More...
- Boolean isErrorResponse
- Convenience property that is true if this is an error response. More...
- Object result
- The result data structure that was returned by the RealityServer command. More...
- Array subResponses
- if isBatchResponse is true, then this array contains objects of type Response for all the sub-commands. More...
Constructor
- com.mi.rs.Response( com.mi.rs.Command command, Object serverResponse)
-
Creates an Response object.
Parameters
- command
- The command object that triggered this response.
- serverResponse
- The response object as sent by the server.
Member Functions
- String com.mi.rs.Response.prototype.toString()
-
Returns a string describing this Object.
Returns
A String describing this Object.
Variables
- com.mi.rs.Command com.mi.rs.Response.prototype.command
-
Returns the command this is the response to.
- Object com.mi.rs.Response.prototype.error
-
Contains information about the error, or null if no error occured. If the error is defined, it will always have a string "message" property with a short description about the error, and a "code" integer property that identifies the error.
- Boolean com.mi.rs.Response.prototype.hasSubErrorResponse
-
Returns true if any of the sub-responses is an error response. This function also takes sub-responses of nested batch commands into account. Note that the Response.error property only say if the batch command itself succedded or not, it does not say anything about the individual sub-commands. Each sub-command needs to be inspected, and this is a convenience method to determine if error handling is needed or not for the sub-responses.
- Boolean com.mi.rs.Response.prototype.isBatchResponse
-
True if this is the response to a batch command. If true then the batch specific methods can be used to easier parse the sub-responses of the batch command.
- Boolean com.mi.rs.Response.prototype.isErrorResponse
-
Convenience property that is true if this is an error response. In this case Response.result will be null and Response.error be set to an object containing more information about the error.
- Object com.mi.rs.Response.prototype.result
-
The result data structure that was returned by the RealityServer command. The result will be null if the command experienced an error. Commands not returning a value will have an empty object as result.
- Array com.mi.rs.Response.prototype.subResponses
-
if isBatchResponse is true, then this array contains objects of type Response for all the sub-commands. sub-responses are in the same order as the sub-commands were added to the original batch request.