Titanium.Network.HTTPClient

Object of Titanium.Network.
Platform Since
Android 0.1
iPhone 0.1
iPad 0.1
Mobile Web 1.8

Summary

The HttpClient instance returned from Titanium.Network.createHTTPClient. This object (mostly) implements the XMLHttpRequest specification.

Description

Mobile web requires cross-domain origin policies to be configured on the web servers in order for cross-domain connections to work.

Methods

Name Summary
abort

abort a pending request

addEventListener

Adds the specified callback as an event listener for the named event.

fireEvent

Fires a synthesized event to any registered listeners.

getConnected

Gets the value of the connected property.

getConnectionType

Gets the value of the connectionType property.

getFile

Gets the value of the file property. (iPhone, iPad only.)

getLocation

Gets the value of the location property.

getOndatastream

Gets the value of the ondatastream property.

getOnerror

Gets the value of the onerror property.

getOnload

Gets the value of the onload property.

getOnreadystatechange

Gets the value of the onreadystatechange property.

getOnsendstream

Gets the value of the onsendstream property.

getReadyState

Gets the value of the readyState property.

getResponseData

Gets the value of the responseData property.

getResponseHeader

return the response header.

getResponseText

Gets the value of the responseText property.

getResponseXML

Gets the value of the responseXML property.

getStatus

Gets the value of the status property.

getTimeout

Gets the value of the timeout property.

getTlsVersion

Gets the value of the tlsVersion property. (iPhone, iPad only.)

getValidatesSecureCertificate

Gets the value of the validatesSecureCertificate property.

open

open the request and ready the connection

removeEventListener

Removes the specified callback as an event listener for the named event.

send

send the request (Only async is currently supported)

setConnected

Sets the value of the connected property.

setConnectionType

Sets the value of the connectionType property.

setFile

Sets the value of the file property. (iPhone, iPad only.)

setLocation

Sets the value of the location property.

setOndatastream

Sets the value of the ondatastream property.

setOnerror

Sets the value of the onerror property.

setOnload

Sets the value of the onload property.

setOnreadystatechange

Sets the value of the onreadystatechange property.

setOnsendstream

Sets the value of the onsendstream property.

setReadyState

Sets the value of the readyState property.

setRequestHeader

set the request header. Must be called after open but before send.

setTimeout

set the request timeout

setTlsVersion

Sets the value of the tlsVersion property. (iPhone, iPad only.)

setValidatesSecureCertificate

Sets the value of the validatesSecureCertificate property.

Properties

Name Type Summary
DONE Number

the DONE readyState constant read-only

HEADERS_RECEIVED Number

the HEADERS_RECEIVED readyState constant read-only

LOADING Number

the LOADING readyState constant read-only

OPENED Number

the OPENED readyState constant read-only

UNSENT Number

the UNSET readyState constant read-only

connected Boolean

boolean to indicate that the response was successful

connectionType String

the connection type, normally either GET or POST.

file String

file to download contents to. Can only be set after calling open. (iPhone, iPad only.)

location String

the absolute URL of the request

ondatastream Callback<Object>

set this to a function before calling open to cause the function to be called at regular intervals as the request data is being received. the progress property of the event will contain a value from 0.0-1.0 with the progress.

onerror Callback<Object>

set this to a function before calling open to cause the function to be called upon a error response

onload Callback<Object>

set this to a function before calling open to cause the function to be called upon a successful response

onreadystatechange Callback<Object>

set this to a function before calling open to cause the function to be called for each readyState change

onsendstream Callback<Object>

set this to a function before calling open to cause the function to be called at regular intervals as the request data is being transmitted. the progress property of the event will contain a value from 0.0-1.0 with the progress.

readyState Number

the readyState value

responseData Titanium.Blob

the response data as a Blob object. read-only

responseText String

the response as text or null if an error was received or no data was returned read-only

responseXML Titanium.XML.Document

the response object as an XML DOMDocument object. returns null if the content type returned by the server was not XML or the content could not be parsed read-only

status Number

the response HTTP status code read-only

timeout Number

timeout is milliseconds when the connection should be aborted

tlsVersion Number

Sets the TLS version to use for handshakes. (iPhone, iPad only.)

validatesSecureCertificate Boolean

set this to control how SSL certification validation is performed on connection. defaults to false if in simulator or device testing and true if release for distribution mode.

Events

This type has no events.