Difference between revisions of "UrlLoader.new"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2012.2.2<br/> === Description === <br /> Creates a new `UrlLoader` object.<br /> <br /> `url` parameter specifies the URL to download....")
 
Line 15: Line 15:
 
<br />
 
<br />
 
<source lang="lua">
 
<source lang="lua">
= UrlLoader.new(urlmethodheadersbody,)
+
UrlLoader.new(url,method,headers,body)
 
</source>
 
</source>
'''url:''' (string, optional) URL to download. This parameter is optional and if specified loading starts immediately. ''''''<br/>
+
'''url''': (string, optional) URL to download. This parameter is optional and if specified loading starts immediately. ''''''<br/>
'''method:''' (string, default = &quot;get&quot;) HTTP request method. ''''''<br/>
+
'''method''': (string, default = &quot;get&quot;) HTTP request method. ''''''<br/>
'''headers:''' (table, optional) HTTP headers. ''''''<br/>
+
'''headers''': (table, optional) HTTP headers. ''''''<br/>
'''body:''' (string, optional) HTTP body data. This data is sent as the message body of a request. ''''''<br/>
+
'''body''': (string, optional) HTTP body data. This data is sent as the message body of a request. ''''''<br/>

Revision as of 10:20, 23 August 2018

Available since: Gideros 2012.2.2

Description


Creates a new `UrlLoader` object.

`url` parameter specifies the URL to download. This parameter is optional and if specified loading starts immediately.

`method` parameter specifies the HTTP request method. It can be one of the values of `UrlLoader.GET`, `UrlLoader.POST`, `UrlLoader.PUT` or `UrlLoader.DELETE`.
The default HTTP method is `UrlLoader.GET`.

`body` parameter specifies the HTTP body data. This parameter is used only when the HTTP method is `UrlLoader.POST` or or `UrlLoader.PUT`.

After loading is finished, loaded data is stored at `event.data` field of `Event.COMPLETE` event as string.

 UrlLoader.new(url,method,headers,body)

'url: (string, optional) URL to download. This parameter is optional and if specified loading starts immediately. '
'method: (string, default = "get") HTTP request method. '
'headers: (table, optional) HTTP headers. '
'body: (string, optional) HTTP body data. This data is sent as the message body of a request. '