Difference between revisions of "UrlLoader"

From GiderosMobile
(Created page with "__NOTOC__ '''Supported platforms:''' <br/> '''Available since:''' Gideros 2012.2.2<br/> === Description === <br /> The `UrlLoader` class is used to download data from an URL....")
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Supported platforms:''' <br/>
+
'''Supported platforms:''' android, ios, mac, pc<br/>
 
'''Available since:''' Gideros 2012.2.2<br/>
 
'''Available since:''' Gideros 2012.2.2<br/>
 
=== Description ===
 
=== Description ===
Line 18: Line 18:
 
</ul><br />
 
</ul><br />
 
<br />
 
<br />
 +
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 
{|-
 
{|-
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Methods ===
 
=== Methods ===
 +
[[UrlLoader.new]] - creates a new UrlLoader object<br/>
 +
[[UrlLoader:close]] - terminates the current loading operation<br/>
 +
[[UrlLoader:ignoreSslErrors]] - Ignores SSL certificate related errors<br/>
 +
[[UrlLoader:load]] - loads data from the specified URL<br/>
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Events ===
 
=== Events ===
 +
[[Event.COMPLETE]]
 +
[[Event.ERROR]]
 +
[[Event.PROGRESS]]
 
=== Constants ===
 
=== Constants ===
 +
[[UrlLoader.DELETE]]
 +
[[UrlLoader.GET]]
 +
[[UrlLoader.POST]]
 +
[[UrlLoader.PUT]]
 
|}
 
|}

Revision as of 08:57, 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