Difference between revisions of "UrlLoader"

Line 17: Line 17:
 
<li>`UrlLoader.DELETE = "delete"`</li><br />
 
<li>`UrlLoader.DELETE = "delete"`</li><br />
 
</ul><br />
 
</ul><br />
<br />
+
<br />{|-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{|-
 
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Methods ===
 
=== Methods ===
Line 45: Line 26:
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Events ===
 
=== Events ===
[[Event.COMPLETE]]
+
[[Event.COMPLETE]]<br/>
[[Event.ERROR]]
+
[[Event.ERROR]]<br/>
[[Event.PROGRESS]]
+
[[Event.PROGRESS]]<br/>
 
=== Constants ===
 
=== Constants ===
[[UrlLoader.DELETE]]
+
[[UrlLoader.DELETE]]<br/>
[[UrlLoader.GET]]
+
[[UrlLoader.GET]]<br/>
[[UrlLoader.POST]]
+
[[UrlLoader.POST]]<br/>
[[UrlLoader.PUT]]
+
[[UrlLoader.PUT]]<br/>
 
|}
 
|}

Revision as of 10:12, 23 August 2018

Supported platforms: android, ios, mac, pc
Available since: Gideros 2012.2.2

Description


The `UrlLoader` class is used to download data from an URL. It can be used to download (and optionally save) text files, XML files, JSON files, image files or binary files, etc.
Downloaded data is delivered at `event.data` field of `Event.COMPLETE` event as string. Lua is eight-bit clean and so strings may contain characters with any numeric value, including embedded zeros. That means that you can store any binary data into a string.

HTTP Request Methods



UrlLoader supports GET, POST, PUT and DELETE methods. These are defined by these string constants:


  • `UrlLoader.GET = "get"`

  • `UrlLoader.POST = "post"`

  • `UrlLoader.PUT = "put"`

  • `UrlLoader.DELETE = "delete"`



{|- | style="width: 50%;"|

Methods

UrlLoader.new - creates a new UrlLoader object
UrlLoader:close - terminates the current loading operation
UrlLoader:ignoreSslErrors - Ignores SSL certificate related errors
UrlLoader:load - loads data from the specified URL
| style="width: 50%;"|

Events

Event.COMPLETE
Event.ERROR
Event.PROGRESS

Constants

UrlLoader.DELETE
UrlLoader.GET
UrlLoader.POST
UrlLoader.PUT
|}