Murl Engine Lua Addon API  Version 1.0 beta
Murl.IUrlRequest

The url request interface.

The IUrlRequest object can be created by the IWebControl object.


Table members

Methods


SetHeaders(headers)

Define custom HTTP headers for the request. This method can be used to define any number of custom HTTP headers sent with the URL request, given as a map containing string key/value pairs for the header names and values, respectively. Note: When using a POST request, the given headers should not include the "Content-Type" and "Content-Length" headers, as they are automatically added during SendPost().

Boolean SetHeaders(Murl.Map.StringString headers)

Parameters
headersThe map of header key/value pairs.
Returns
Boolean true if successful.

ClearHeaders()

Clear any custom HTTP headers for the request.

Boolean ClearHeaders()

Returns
Boolean true if successful.

SendGet(url, timeout)

Send a url-request with http method GET. When posting a url-request the IsPending() state is true. If the url-request was successful the WasFinished() state is true and the response data can be accessed by GetResponseData().

Boolean SendGet(String url, Number timeout)

Parameters
urlThe url string to send to.
timeoutThe request timeout in seconds.
Returns
Boolean true if successful.

SendPost(url, body, contentType, timeout)

Send a url-request with http method POST. When posting a url-request the IsPending() state is true. If the url-request was successful the WasFinished() state is true and the response data can be accessed by GetResponseData().
If the url is redirected, the POST is cancelled and WasRejected() state is true.

Boolean SendPost(String url, Murl.Data body, String contentType, Number timeout)

Parameters
urlThe url string to send to.
bodyThe body data to send.
contentTypeThe string for the "Content-Type" http header field.
timeoutThe request timeout in seconds.
Returns
Boolean true if successful.

GetHeaders()

Get the custom HTTP headers defined for this request.

Murl.Map.StringString GetHeaders()

Returns
Murl.Map.StringString The map of header key/value pairs.

GetUrlString()

Get the url-request string.

String GetUrlString()

Returns
String The url which was passed to SendGet() or SendPost().

GetResponseData()

Get the url-request response data. The data is available if WasFinished() returns true.

Murl.Data GetResponseData()

Returns
Murl.Data The url-request response data.

GetResponseHeaders()

Get the HTTP headers received with this URL request's response. The headers are available if WasFinished() returns true.

Murl.Map.StringString GetResponseHeaders()

Returns
Murl.Map.StringString The map of header key/value pairs.

GetCurrentDataSize()

Get the current response data size. The size is updated while receiving data asynchronous.

Integer GetCurrentDataSize()

Returns
Integer The current response data byte size.

ReleaseData()

Release the response data. Releasing the data can be performed only if the url-request is not pending.

Boolean ReleaseData()

Returns
Boolean true if successful.

IsPending()

Check if the url-request is pending.

Boolean IsPending()

Returns
Boolean true if the url-request is pending.

WasFinished()

Check if the url-request was finished in the most recent tick.

Boolean WasFinished()

Returns
Boolean true if the url-request was finished in the most recent tick.

WasRejected()

Check if the url-request was rejected in the most recent tick.

Boolean WasRejected()

Returns
Boolean true if the url-request was rejected in the most recent tick.