Core.Web
HttpConnection
Class Hierarchy:

An HTTP connection to the hosting server. This method provides a cross platform wrapper for XMLHttpRequest and additionally allows method reference-based listener registration.

Constructor Summary
Public Core.Web.HttpConnection()
Creates a new HttpConnection.

Instance Field Summary
Internal _url
The URL.
Internal _contentType
The request content type.
Internal _method
The request method.
Internal _messageObject
The message content object.
Internal _listenerList
Listener storage facility.
Internal _disposed
Disposed state.
Internal _xmlHttpRequest
Browser XMLHttpRequest object.
Internal _requestHeaders
Request header value map.

Instance Method Summary
Internal _preprocessSafariDOM()
Preprocesses outgoing requests to Safari (invoked when appropriate quirk is detected).
Public addResponseListener()
Adds a response listener to be notified when a response is received from the connection.
Public connect()
Executes the HTTP connection.
Public dispose()
Disposes of the connection.
Public getResponseHeader()
Returns a header from the received response.
Public getAllResponseHeaders()
Returns all the headers of the response.
Public getStatus()
Returns the response status code of the HTTP connection, if available.
Public getResponseText()
Returns the response as text.
Public getResponseXml()
Returns the response as an XML DOM.
Internal _processReadyStateChange()
Event listener for readystatechange events received from the XMLHttpRequest.
Public removeResponseListener()
Removes a response listener to be notified when a response is received from the connection.
Public setRequestHeader()
Sets a header in the request.

Constructor Detail
Core.Web.HttpConnection()
Creates a new HttpConnection. This method simply configures the connection, the connection will not be opened until connect() is invoked.
Parameters:
url (String) - the target URL
method (String) - the connection method, i.e., GET or POST
messageObject - the message to send (may be a String or XML DOM)
contentType (String) - the request content-type

Instance Method Detail
_preprocessSafariDOM
Preprocesses outgoing requests to Safari (invoked when appropriate quirk is detected). All less than, greater than, and ampersands are replaced with escaped values, as this browser is broken in this regard and will otherwise fail. Recursively invoked on nodes, starting with document element.
Parameters:
node (Node) - the node to process

addResponseListener
Adds a response listener to be notified when a response is received from the connection.
Parameters:
l (Function) - the listener to add

connect
Executes the HTTP connection. This method will return before the HTTP connection has received a response.

dispose
Disposes of the connection. This method must be invoked when the connection will no longer be used/processed.

getResponseHeader
Returns a header from the received response.
Parameters:
header (String) - the header to retrieve

getAllResponseHeaders
Returns all the headers of the response.
Parameters:
header (String) - the header to retrieve

getStatus
Returns the response status code of the HTTP connection, if available.
Returns:
(Integer) the response status code

getResponseText
Returns the response as text. This method may only be invoked from a response handler.
Returns:
(String) the response, as text

getResponseXml
Returns the response as an XML DOM. This method may only be invoked from a response handler.
Returns:
(Document) the response, as an XML DOM

_processReadyStateChange
Event listener for readystatechange events received from the XMLHttpRequest.

removeResponseListener
Removes a response listener to be notified when a response is received from the connection.
Parameters:
l (Function) - the listener to remove

setRequestHeader
Sets a header in the request.
Parameters:
header (String) - the header to retrieve
value (String) - the value of the header