telosys.objects
Class HttpRequester

java.lang.Object
  extended bytelosys.objects.HttpRequester

public class HttpRequester
extends java.lang.Object

Simple HTTP Requester for AJAX requests ( XMLHttpRequest wrapper class )


Constructor Summary
HttpRequester()
          Creates a new requester without callback ( so no response processing )
HttpRequester(function callback)
          Creates a new requester with a callback function for response processing
HttpRequester(function callback, function errorCallback)
          Creates a new requester with a callback function for response processing and another one for error processing
 
Method Summary
 string getHttpStatus()
          Returns last response HTTP Status ( XHR.status )
 string getRequestContent()
          Returns last request content (request body)
 string getRequestContentType()
          Returns last request content type
 string getResponseText()
          Returns last response as text ( XHR.responseText )
 object getResponseXML()
          Returns last response as an XML DOM tree ( XHR.responseXML )
 void httpGetAsync(string sUrl, string sContent, string sContentType)
          Send an "GET" HTTP request to the server in asynchronous mode
 void httpGetSync(string sUrl, string sContent, string sContentType)
          Send an "GET" HTTP request to the server in synchronous mode
 void httpPostAsync(string sUrl, string sContent, string sContentType)
          Send an "POST" HTTP request to the server in asynchronous mode
 void httpPostSync(string sUrl, string sContent, string sContentType)
          Send an "POST" HTTP request to the server in synchronous mode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpRequester

public HttpRequester()
Creates a new requester without callback ( so no response processing )


HttpRequester

public HttpRequester(function callback)
Creates a new requester with a callback function for response processing

Parameters:
callback -

HttpRequester

public HttpRequester(function callback,
                     function errorCallback)
Creates a new requester with a callback function for response processing and another one for error processing

Parameters:
callback -
errorCallback -
Method Detail

getRequestContent

public string getRequestContent()
Returns last request content (request body)

Returns:

getRequestContentType

public string getRequestContentType()
Returns last request content type

Returns:

getHttpStatus

public string getHttpStatus()
Returns last response HTTP Status ( XHR.status )

Returns:

getResponseText

public string getResponseText()
Returns last response as text ( XHR.responseText )

Returns:

getResponseXML

public object getResponseXML()
Returns last response as an XML DOM tree ( XHR.responseXML )

Returns:

httpGetSync

public void httpGetSync(string sUrl,
                        string sContent,
                        string sContentType)
Send an "GET" HTTP request to the server in synchronous mode

Parameters:
sUrl -
sContent -
sContentType -

httpGetAsync

public void httpGetAsync(string sUrl,
                         string sContent,
                         string sContentType)
Send an "GET" HTTP request to the server in asynchronous mode

Parameters:
sUrl -
sContent -
sContentType -

httpPostSync

public void httpPostSync(string sUrl,
                         string sContent,
                         string sContentType)
Send an "POST" HTTP request to the server in synchronous mode

Parameters:
sUrl -
sContent -
sContentType -

httpPostAsync

public void httpPostAsync(string sUrl,
                          string sContent,
                          string sContentType)
Send an "POST" HTTP request to the server in asynchronous mode

Parameters:
sUrl -
sContent -
sContentType -