| Package | com.arc90.rpc.rest |
| Class | public class RESTService |
| Inheritance | RESTService flash.events.EventDispatcher |
Note: Due to Flash Player security restrictions, the RESTService class will only work under very specific conditions when delivered via the Web. However, an AIR application should not be subject to the same restrictions.
| Property | Defined by | ||
|---|---|---|---|
| contentType : String
Type of content for service requests.
| RESTService | ||
| headers : Object
Custom HTTP headers to be sent with the request.
| RESTService | ||
| lastRequest : Object [read-only]
The result of the last RESTService operation.
| RESTService | ||
| method : String
HTTP method for sending the request.
| RESTService | ||
| port : int
Specifies the port to be used in service calls.
| RESTService | ||
| request : Object
Object of name-value pairs used as parameters to the URL.
| RESTService | ||
| requestTimeout : int = 0
Provides access to the request timeout in seconds for sent messages.
| RESTService | ||
| resultFormat : String
Value that indicates how you want to deserialize the result
returned by the HTTP call.
| RESTService | ||
| rootURL : String
The base url for service calls.
| RESTService | ||
| showBusyCursor : Boolean = false
If
true, show the busy cursor while executing service calls. | RESTService | ||
| url : String
The URL to use for the service call.
| RESTService | ||
| Method | Defined by | ||
|---|---|---|---|
|
RESTService(rootURL:String = "", port:int = 80)
Constructor.
| RESTService | ||
|
cancel():void
Cancels the currently executing request.
| RESTService | ||
|
clearCredentials():void
Clears the user credentials set by
setCredentials. | RESTService | ||
|
send():void
Executes a RESTService request.
| RESTService | ||
|
setCredentials(username:String, password:String):void
Sets credentials to be passed to the service on all service calls.
| RESTService | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when a RESTService call fails. | RESTService | |||
| Dispatched when a RESTService call returns successfully. | RESTService | |||
| Constant | Defined by | ||
|---|---|---|---|
| CONTENT_TYPE_FORM : String = "application/x-www-form-urlencoded" [static]
Indicates that the data being sent by the RESTService is encoded as application/x-www-form-urlencoded.
| RESTService | ||
| CONTENT_TYPE_MULTIPART : String = "multipart/form-data" [static]
Indicates that the data being sent by the RESTService is encoded as multipart/form-data.
| RESTService | ||
| CONTENT_TYPE_XML : String = "application/xml" [static]
Indicates that the data being sent by the RESTService is encoded as application/xml.
| RESTService | ||
| RESULT_FORMAT_BINARY : String = "binary" [static]
The result format "binary" specifiec the value returned is of type
flash.utils.ByteArray. | RESTService | ||
| RESULT_FORMAT_FLASHVARS : String = "flashvars" [static]
The result format "flashvars" specifies that the value returned is text containing name=value pairs
separated by ampersands, which is parsed into an ActionScript object.
| RESTService | ||
| RESULT_FORMAT_TEXT : String = "text" [static]
The result format "text" specifies that the RESTService result text should be an unprocessed String.
| RESTService | ||
| RESULT_FORMAT_XML : String = "xml" [static]
The result format "xml" specifies that the value returned is an XML instance, which can be accessed using ECMAScript for XML (E4X) expressions.
| RESTService | ||
| contentType | property |
contentType:String [read-write]
Type of content for service requests.
The default is application/xml which sends requests as XML.
The default value is application/xml.
public function get contentType():String
public function set contentType(value:String):void
| headers | property |
public var headers:ObjectCustom HTTP headers to be sent with the request.
| lastRequest | property |
lastRequest:Object [read-only]The result of the last RESTService operation.
The value returned is a generic object with the following properties:
headers Object Name/Value pairsresponse response body.statusCode Number HTTP Response CodestatusMessage String HTTP Response Messageversion String HTTP Version public function get lastRequest():Object
| method | property |
method:String [read-write]
HTTP method for sending the request. Permitted values are GET, POST, HEAD,
OPTIONS, PUT, TRACE and DELETE.
Lowercase letters are converted to uppercase letters.
The default value is GET.
public function get method():String
public function set method(value:String):void
| port | property |
port:int [read-write]Specifies the port to be used in service calls.
If the port is not explicitly set, and the url used in the service calls utilizes the https protocol, the port will be set to 443 automatically.
The default value is 80.
public function get port():int
public function set port(value:int):void
| request | property |
public var request:Object
Object of name-value pairs used as parameters to the URL. If
the contentType property is set to application/xml, it should be an XML document.
| requestTimeout | property |
public var requestTimeout:int = 0Provides access to the request timeout in seconds for sent messages. A value less than or equal to zero prevents request timeout.
The default value is 0.
| resultFormat | property |
resultFormat:String [read-write]Value that indicates how you want to deserialize the result returned by the HTTP call.
The default value is xml.
public function get resultFormat():String
public function set resultFormat(value:String):void
| rootURL | property |
public var rootURL:StringThe base url for service calls.
| showBusyCursor | property |
public var showBusyCursor:Boolean = false
If true, show the busy cursor while executing service calls.
The default value is false.
| url | property |
public var url:StringThe URL to use for the service call.
| RESTService | () | constructor |
public function RESTService(rootURL:String = "", port:int = 80)Constructor.
ParametersrootURL:String (default = "") — The base url to use in all service calls.
|
|
port:int (default = 80) — The port to use in all service calls.
|
| cancel | () | method |
public function cancel():voidCancels the currently executing request.
| clearCredentials | () | method |
public function clearCredentials():void
Clears the user credentials set by setCredentials.
| send | () | method |
public function send():voidExecutes a RESTService request.
| setCredentials | () | method |
public function setCredentials(username:String, password:String):voidSets credentials to be passed to the service on all service calls. Credentials are passed using Basic HTTP Authentication.
Parametersusername:String — The username
|
|
password:String — The password
|
| fault | event |
| result | event |
com.arc90.rpc.events.ResultEvent
Dispatched when a RESTService call returns successfully.
| CONTENT_TYPE_FORM | constant |
public static const CONTENT_TYPE_FORM:String = "application/x-www-form-urlencoded"Indicates that the data being sent by the RESTService is encoded as application/x-www-form-urlencoded.
| CONTENT_TYPE_MULTIPART | constant |
public static const CONTENT_TYPE_MULTIPART:String = "multipart/form-data"Indicates that the data being sent by the RESTService is encoded as multipart/form-data.
| CONTENT_TYPE_XML | constant |
public static const CONTENT_TYPE_XML:String = "application/xml"Indicates that the data being sent by the RESTService is encoded as application/xml.
| RESULT_FORMAT_BINARY | constant |
public static const RESULT_FORMAT_BINARY:String = "binary"
The result format "binary" specifiec the value returned is of type flash.utils.ByteArray.
| RESULT_FORMAT_FLASHVARS | constant |
public static const RESULT_FORMAT_FLASHVARS:String = "flashvars"The result format "flashvars" specifies that the value returned is text containing name=value pairs separated by ampersands, which is parsed into an ActionScript object.
| RESULT_FORMAT_TEXT | constant |
public static const RESULT_FORMAT_TEXT:String = "text"The result format "text" specifies that the RESTService result text should be an unprocessed String.
| RESULT_FORMAT_XML | constant |
public static const RESULT_FORMAT_XML:String = "xml"The result format "xml" specifies that the value returned is an XML instance, which can be accessed using ECMAScript for XML (E4X) expressions.