Packagegs.remoting
Classpublic class RemotingCall

The RemotingCall class simplifies making remoting calls.

Examples are in the guttershark repository.



Public Properties
 PropertyDefined by
  clearListenersOnSuccess : Boolean
RemotingCall
  connection : NetConnection
Net connection for the remoting call.
RemotingCall
  endpoint : String
The service endpoint.
RemotingCall
  gateway : String
The remoting gateway.
RemotingCall
  method : String
The service method.
RemotingCall
  onBadVersion : Function
On bad version callback.
RemotingCall
  onClose : Function
The handler for when you close this call by calling close().
RemotingCall
  onClosed : Function
On closed callback.
RemotingCall
  onConnect : Function
On connection callback.
RemotingCall
  onConnectFailed : Function
On connect failed callback.
RemotingCall
  onFault : Function
On fault callback.
RemotingCall
  onFirstCall : Function
On first call callback.
RemotingCall
  onIOError : Function
On io error event callback.
RemotingCall
  onProhibited : Function
On prohibited callback.
RemotingCall
  onResult : Function
On result callback.
RemotingCall
  onRetry : Function
On retry callback.
RemotingCall
  onSecurityError : Function
On security error callback.
RemotingCall
  onTimeout : Function
On timeout callback.
RemotingCall
  resultHandler : Class
The handler class that processes the returned result - this should be an instance or subclass of RemotingCallResultHandler.
RemotingCall
  retries : int
The number of retries to allow (default is 1).
RemotingCall
  returnArgs : Boolean
Whether or not to return the args back to your onResult or onFault callback.
RemotingCall
  statusEvent : NetStatusEvent
The last status event that was dispatched off of the internal net connection.
RemotingCall
  timeout : int
The time to allow for each call before another retry is sent (default is 3000, 3 seconds).
RemotingCall
Public Methods
 MethodDefined by
  
RemotingCall(_gateway:String, _endpoint:String, _method:String, _objectEncoding:int = 3, _timeout:int = 3000, _retries:int = 1, _resultHandler:Class = null)
Constructor for RemotingCall instances.
RemotingCall
  
close():void
Closes the internal net connection and cancels the request.
RemotingCall
  
get(id:String):RemotingCall
[static] Get a remoting call.
RemotingCall
  
send(... _args):void
Send the call.
RemotingCall
  
set(id:String, rc:RemotingCall):void
[static] Set a remoting call instance.
RemotingCall
  
setCallbacks(callbacks:Object):void
Set callbacks.
RemotingCall
  
setCredentials(username:String, password:String):void
Add a credentials header.
RemotingCall
  
setGateway(name:String, url:String):void
[static] Save a gateway by name.
RemotingCall
  
unset(id:String):void
[static] Unset (delete) a remoting call instance.
RemotingCall
Property detail
clearListenersOnSuccessproperty
public var clearListenersOnSuccess:Boolean
connectionproperty 
public var connection:NetConnection

Net connection for the remoting call.

endpointproperty 
public var endpoint:String

The service endpoint.

gatewayproperty 
public var gateway:String

The remoting gateway.

methodproperty 
public var method:String

The service method.

onBadVersionproperty 
public var onBadVersion:Function

On bad version callback.

onCloseproperty 
public var onClose:Function

The handler for when you close this call by calling close().

onClosedproperty 
public var onClosed:Function

On closed callback.

onConnectproperty 
public var onConnect:Function

On connection callback.

onConnectFailedproperty 
public var onConnectFailed:Function

On connect failed callback.

onFaultproperty 
public var onFault:Function

On fault callback.

onFirstCallproperty 
public var onFirstCall:Function

On first call callback.

onIOErrorproperty 
public var onIOError:Function

On io error event callback.

onProhibitedproperty 
public var onProhibited:Function

On prohibited callback.

onResultproperty 
public var onResult:Function

On result callback.

onRetryproperty 
public var onRetry:Function

On retry callback.

onSecurityErrorproperty 
public var onSecurityError:Function

On security error callback.

onTimeoutproperty 
public var onTimeout:Function

On timeout callback.

resultHandlerproperty 
public var resultHandler:Class

The handler class that processes the returned result - this should be an instance or subclass of RemotingCallResultHandler.

retriesproperty 
public var retries:int

The number of retries to allow (default is 1).

returnArgsproperty 
public var returnArgs:Boolean

Whether or not to return the args back to your onResult or onFault callback.

statusEventproperty 
public var statusEvent:NetStatusEvent

The last status event that was dispatched off of the internal net connection.

timeoutproperty 
public var timeout:int

The time to allow for each call before another retry is sent (default is 3000, 3 seconds).

Constructor detail
RemotingCall()constructor
public function RemotingCall(_gateway:String, _endpoint:String, _method:String, _objectEncoding:int = 3, _timeout:int = 3000, _retries:int = 1, _resultHandler:Class = null)

Constructor for RemotingCall instances.

Parameters
_gateway:String — The remoting gateway url.
 
_endpoint:String — The endpoint.
 
_method:String — The method to call.
 
_objectEncoding:int (default = 3) — The timeout for this call.
 
_timeout:int (default = 3000) — The number of retries for this call.
 
_retries:int (default = 1) — A result handler class to process result or fault objects before passing it back to your onResult or onFault callback.
 
_resultHandler:Class (default = null)
Method detail
close()method
public function close():void

Closes the internal net connection and cancels the request.

get()method 
public static function get(id:String):RemotingCall

Get a remoting call.

Parameters
id:String — The remoting call id.

Returns
RemotingCall
send()method 
public function send(... _args):void

Send the call.

Parameters
... _args — The remoting servie to send the call to.
set()method 
public static function set(id:String, rc:RemotingCall):void

Set a remoting call instance.

Parameters
id:String — The remoting call id.
 
rc:RemotingCall — The remoting call instance.
setCallbacks()method 
public function setCallbacks(callbacks:Object):void

Set callbacks.

You can pass these callback properties:

Parameters
callbacks:Object — An object with properties for callbacks you want.
setCredentials()method 
public function setCredentials(username:String, password:String):void

Add a credentials header.

Parameters
username:String — The username.
 
password:String — The password.
setGateway()method 
public static function setGateway(name:String, url:String):void

Save a gateway by name.

If you save a gateway you can use the shortcut name when creating new RemotingCall instances.

Parameters
name:String — The shortcut name for the gateway (something like amfphp).
 
url:String — The gateay url.

Example
Saving gateways.
 
   RemotingCall.setGateway("amfphp","http://guttershark_amfphp/gateway.php");
   var rc:RemotingConnection = new RemotingConnection("amfphp","Echoer","echoString");
   
   //if you don't save the gateway, you have to provide the gateway url like this:
   var rc:RemotingConnection = new RemotingConnection("http://guttershark_amfphp/gateway.php","Echoer","echoString");
   

unset()method 
public static function unset(id:String):void

Unset (delete) a remoting call instance.

Parameters
id:String — The remoting call id.