|
The Gravey 2.0 Framework and AIM RIA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--XMLreq
Constructor for XMLreq "object" which encapsulates a REST-style
request/reply transaction that returns XML or Text. This class makes
multiple simultaneous requests possible, however, a separate instance
of this class is required for each request. This constructor will
automatically cause this request to be immediately launched unless
launch is suppressed.
If post data is defined then this request is made via a POST (otherwise via a GET) HTTP request.
Any instance of this class can be created in "test mode" that reads
XML directly from an XML file rather than making a POST/GET request for XML.
This class has helper methods that will transform the response XML via
an XSL document specified via filename or URL.
Version: 2.0
Author: Bruce Wallace (PolyGlotInc.com)
Defined in grvAJAX.js
| Constructor Summary | |
XMLreq
()
|
|
| Method Summary | |
void
|
cbwrapper()
callback wrapper method to relieve user callback from gory details of XMLHttpRequest state transition handling. |
String
|
getResponseText()
get text returned in the reply to "this" xml request |
Object
|
getResponseXML()
get XML returned in the reply to "this" xml request |
void
|
konstructor( <String> url, <Function> userCallbackFunction, <String> optPostData, <boolean> optWaitFlag, <boolean> optTestFlag, <boolean> optSuppressLaunchFlag )
|
void
|
launch()
method to launch "this" request using the following logic;
To send CGI variables using the GET request method, we have to
hardcode the variables into the open URL parameter:
this.open("GET", "/query.cgi?name=Bob&email=bob@example.com");
this.send(null);
To send CGI variables using the POST request method, we have to
pass the variables to the send() method:
this.open("POST", "/query.cgi");
this.send("name=Bob&email=bob@example.com");
|
Object
|
newRequestObj()
method to create new XMLHttpRequest object for "this" request |
String
|
toString()
method to return "this" as a human-readable string |
String
|
xform( xslURL )
return the output from transforming the response XML with the XSL in the specified URL/filename |
String
|
xform2( xslDOM )
return the output from transforming the response XML with the XSL in the specified XSL DOM |
| Constructor Detail |
XMLreq()
| Method Detail |
void cbwrapper()
String getResponseText()
Object getResponseXML()
void konstructor( <String> url, <Function> userCallbackFunction, <String> optPostData, <boolean> optWaitFlag, <boolean> optTestFlag, <boolean> optSuppressLaunchFlag )
url - the URL to request XML from (or XML file path in test mode)
userCallbackFunction - the callback to handle the XML when it arrives [note: The callback will have this XMLreq object passed to it via both "this", and, as a single function argument.]
optPostData - optional post data string (should be "undefined" if not a POST req.)
optWaitFlag - optional "wait for reply" flag (i.e. DONT do this async if true)
optTestFlag - optional "read test files" flag (i.e. read XML file rather than ask server)
optSuppressLaunchFlag - optional "suppress launch" flag
void launch()
To send CGI variables using the GET request method, we have to
hardcode the variables into the open URL parameter:
this.open("GET", "/query.cgi?name=Bob&email=bob@example.com");
this.send(null);
To send CGI variables using the POST request method, we have to
pass the variables to the send() method:
this.open("POST", "/query.cgi");
this.send("name=Bob&email=bob@example.com");
Object newRequestObj()
String toString()
String xform( xslURL )
String xform2( xslDOM )
|
The Gravey 2.0 Framework and AIM RIA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||