Difference between revisions of "UrlLoader"

From GiderosMobile
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 ===

Revision as of 10:04, 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"`



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

Events

Event.COMPLETE
Event.ERROR
Event.PROGRESS

Constants

UrlLoader.DELETE
UrlLoader.GET
UrlLoader.POST
UrlLoader.PUT