content: DynamicHttpRequest
##HttpRequest
This class represents an Http Request
@author Simone Cingano (yupswing) Akifox Studio
@repo akifox-asynchttp repository
@licence MIT Licence
Instance Members
finalised: BoolTell if the instance is immutable
NOTE: The only way to change an immutable instance is copying it (instance.clone()) and change the copy
fingerprint: StringThe fingerprint is a unique 8 char key which identify this request instance
headers: HttpHeadersThe request headers
timeout: IntThe request timeout in seconds (default:10)
If the request receive no answer for more than the timeout it aborts
async: BoolAsynchronous (default is true)
NOTE: When async==true the application execution will be hold until the request is completed
NOTE: Always true in FLASH due to platform limitations
http11: BoolHttp Protocol Version flag
Tells if enable HTTP/1.1 (true
url: URLThe URL to be retrived
Accept a string (format:protocol://host:port/resource?querystring) or a URL instance
NOTE: It supports HTTP+HTTPS protocol (HTTPS on CPP+NEKO platform only with the HXSSL library)
NOTE: On FLASH and JAVASCRIPT relative URLs are allowed
method: StringThe HTTP Method
Accepted values are HttpMethod.GET, .POST, .PUT, .DELETE
NOTE: On JAVASCRIPT only GET and POST are functional due to platform limitations
The HTTP Content
NOTE: You could provide a Bytes or a String according to the Content-type (Binary or Text)
contentType: StringThe HTTP Content-Type (default:application/x-www-form-urlencoded)
Content-Type list:(http://www.iana.org/assignments/media-types/media-types.xhtml)
contentIsBinary: BoolContent binary flag (tells if the content binary or text)
NOTE: This is set automatically when a content-type is set
toString(): String| Returns |
|---|
| String |
clone(): HttpRequestDeep copy of the HttpRequest
NOTE: The copy will be always mutable despite of the master status
| Returns |
|---|
| HttpRequest |
finalise(): VoidMake this instance immutable
NOTE: This method is called automatically once this HttpRequest instance is sent
send(): VoidSend the request and call the callback when it is done
NOTE: When async==true the application execution will be hold until the request is completed
NOTE: When a HttpRequest is sent the instance is made immutable (you have to clone it to send again the same request)
callback(): VoidThe callback function to be called when the response returns
NOTE: This will be called always if no callbackError is set
Otherwise it will be called only if the response is valid
callbackError(): VoidThe callback error (optional) function to be called when the response returns an error
NOTE: This will be called only if set and in error case
The callbackProgress (optional) function to be called when get any data on an HTTP Transfer It gets called for sure at the beginning and end of any transfer and (if the HTTP transfer mode supports it) also in between the transfer.
The function has to accept two parameters:
-
loaded:Int the received bytes
-
total:Int the total bytes (-1 if unknown)
| Name | Type |
|---|---|
| `` | Int |
| `` | Int |
new(?options: Null<HttpRequestOptions> = null): VoidClass instance
| Name | Type | Default | Description |
|---|---|---|---|
options |
Null<HttpRequestOptions> | null |
HttpRequestOptions object or null (NOTE: every parameter could be changed also after the class instance) |
Private Members
DEFAULT_CONTENT_TYPE: String