Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIHttpTaskBase Class Reference
Inheritance diagram for MOAIHttpTaskBase:
MOAIHttpTaskNaCl MOAIHttpTaskNaCl MOAIHttpTaskNSURL

List of all members.

Function List

  getProgress
  getResponseCode
  getResponseHeader
  getSize
  getString
  httpGet
  httpPost
  isBusy
  parseXml
  performAsync
  performSync
  setBody
  setCallback
  setCookieSrc
  setCookieDst
  setFailOnError
  setFollowRedirects
  setHeader
  setStream
  setTimeout
  setUrl
  setUserAgent
  setVerb
  setVerbose

Function Documentation

Returns the progress of the download.


function getProgress ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
progress ( number )

Returns the response code returned by the server after a httpPost or httpGet call.


function getResponseCode ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
code ( number )

Returns the response header given its name, or nil if it wasn't provided by the server. Header names are case-insensitive and if multiple responses are given, they will be concatenated with a comma separating the values.


function getResponseHeader ( MOAIHttpTaskBase self, string header )
Parameters:
self ( MOAIHttpTaskBase )
header ( string ) The name of the header to return (case-insensitive).
Returns:
response ( string )

Returns the size of the string obtained from a httpPost or httpGet call.


function getSize ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
size ( number )

Returns the text obtained from a httpPost or httpGet call.


function getString ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
text ( string )

Sends an API call to the server for downloading data. The callback function (from setCallback) will run when the call is complete, i.e. this action is asynchronous and returns almost instantly.


function httpGet ( MOAIHttpTaskBase self, string url [, string useragent, boolean verbose, boolean blocking ] )
Parameters:
self ( MOAIHttpTaskBase )
url ( string ) The URL on which to perform the GET request.
useragent ( string ) Optional. Default value is "Moai SDK beta; support
verbose ( boolean ) Optional.
blocking ( boolean ) Optional. Synchronous operation; block execution until complete. Default value is false.
Returns:
nil

Sends an API call to the server for downloading data. The callback function (from setCallback) will run when the call is complete, i.e. this action is asynchronous and returns almost instantly.


function httpPost ( MOAIHttpTaskBase self, string url [, string data, string useragent, boolean verbose, boolean blocking ] )
Parameters:
self ( MOAIHttpTaskBase )
url ( string ) The URL on which to perform the GET request.
data ( string ) Optional. The string containing text to send as POST data.
useragent ( string ) Optional. Default value is "Moai SDK beta; support
verbose ( boolean ) Optional.
blocking ( boolean ) Optional. Synchronous operation; block execution until complete. Default value is false.
Returns:
nil
Note:

function httpPost ( MOAIHttpTaskBase self, string url [, MOAIDataBuffer data, string useragent, boolean verbose, boolean blocking ] )
Parameters:
self ( MOAIHttpTaskBase )
url ( string ) The URL on which to perform the GET request.
data ( MOAIDataBuffer ) Optional. A MOAIDataBuffer object to send as POST data.
useragent ( string ) Optional.
verbose ( boolean ) Optional.
blocking ( boolean ) Optional. Synchronous operation; block execution until complete. Default value is false.
Returns:
nil
Note:

Returns whether or not the task is busy.


function isBusy ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
busy ( boolean )

Parses the text data returned from a httpGet or httpPost operation as XML and then returns a MOAIXmlParser with the XML content initialized.


function parseXml ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
parser ( MOAIXmlParser )

Perform the HTTP task asynchronously.


function performAsync ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
nil

Perform the HTTP task synchronously ( blocking).


function performSync ( MOAIHttpTaskBase self )
Parameters:
self ( MOAIHttpTaskBase )
Returns:
nil

Sets the body for a POST or PUT.


function setBody ( MOAIHttpTaskBase self [, string data ] )
Parameters:
self ( MOAIHttpTaskBase )
data ( string ) Optional. The string containing text to send as POST data.
Returns:
nil
Note:

function setBody ( MOAIHttpTaskBase self [, MOAIDataBuffer data ] )
Parameters:
self ( MOAIHttpTaskBase )
data ( MOAIDataBuffer ) Optional. A MOAIDataBuffer object to send as POST data.
Returns:
nil
Note:

Sets the callback function used when a request is complete.


function setCallback ( MOAIHttpTaskBase self, function callback )
Parameters:
self ( MOAIHttpTaskBase )
callback ( function ) The function to execute when the HTTP request is complete. The MOAIHttpTaskBase is passed as the first argument.
Returns:
nil

Sets the file to save the cookies for this HTTP request.


function setCookieDst ( MOAIHttpTaskBase self, string filename )
Parameters:
self ( MOAIHttpTaskBase )
filename ( string ) name and path of the file to save the cookies to
Returns:
nil

Sets the file to read the cookies for this HTTP request.


function setCookieSrc ( MOAIHttpTaskBase self, string filename )
Parameters:
self ( MOAIHttpTaskBase )
filename ( string ) name and path of the file to read the cookies from
Returns:
nil

Sets whether or not curl calls will fail if the HTTP status code is above 400.


function setFailOnError ( MOAIHttpTaskBase self, boolean enable )
Parameters:
self ( MOAIHttpTaskBase )
enable ( boolean )
Returns:
nil

Sets whether or not curl should follow HTTP header redirects.


function setFollowRedirects ( MOAIHttpTaskBase self, boolean follow )
Parameters:
self ( MOAIHttpTaskBase )
follow ( boolean )
Returns:
nil

Sets a custom header field. May be used to override default headers.


function setHeader ( MOAIHttpTaskBase self, string key [, string value ] )
Parameters:
self ( MOAIHttpTaskBase )
key ( string )
value ( string ) Optional. Default is "".
Returns:
nil

Sets a custom stream to read data into.


function setStream ( MOAIHttpTaskBase self, MOAIStream stream )
Parameters:
self ( MOAIHttpTaskBase )
stream ( MOAIStream )
Returns:
nil

Sets the timeout for the task.


function setTimeout ( MOAIHttpTaskBase self, number timeout )
Parameters:
self ( MOAIHttpTaskBase )
timeout ( number )
Returns:
nil

Sets the URL for the task.


function setUrl ( MOAIHttpTaskBase self, string url )
Parameters:
self ( MOAIHttpTaskBase )
url ( string )
Returns:
nil

Sets the 'useragent' header for the task.


function setUserAgent ( MOAIHttpTaskBase self [, string useragent ] )
Parameters:
self ( MOAIHttpTaskBase )
useragent ( string ) Optional. Default value is "Moai SDK beta; support
Returns:
nil

Sets the HTTP verb.


function setVerb ( MOAIHttpTaskBase self, number verb )
Parameters:
self ( MOAIHttpTaskBase )
verb ( number ) One of MOAIHttpTaskBase.HTTP_GET, MOAIHttpTaskBase.HTTP_HEAD, MOAIHttpTaskBase.HTTP_POST, MOAIHttpTaskBase.HTTP_PUT, MOAIHttpTaskBase.HTTP_DELETE
Returns:
nil

Sets the task implementation to print out debug information (if any).


function setVerbose ( MOAIHttpTaskBase self [, boolean verbose ] )
Parameters:
self ( MOAIHttpTaskBase )
verbose ( boolean ) Optional. Default value is false.
Returns:
nil