The Gravy Framework

Class XMLreq

Object
   |
   +--XMLreq

class 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.
Defined in ajax.js

Author: Bruce Wallace (PolyGlotInc.com)
Version: 1.0


Field Summary
 Object async
          
 Object cb
          
 Object name
          
 Object post
          
 Object test
          
 Object url
          
 Object usercb
          
 
Constructor Summary
XMLreq ( <String> url, <Function> userCallbackFunction, <String> optPostData, <boolean> optWaitFlag, <boolean> optTestFlag, <boolean> optSuppressLaunchFlag )
           
 
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 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

Field Detail

async

Object async

cb

Object cb

name

Object name

post

Object post

test

Object test

url

Object url

usercb

Object usercb

Constructor Detail

XMLreq

XMLreq( <String> url, <Function> userCallbackFunction, <String> optPostData, <boolean> optWaitFlag, <boolean> optTestFlag, <boolean> optSuppressLaunchFlag )

Method Detail

cbwrapper

void cbwrapper()

getResponseText

String getResponseText()

getResponseXML

Object getResponseXML()

launch

void launch()

newRequestObj

Object newRequestObj()

toString

String toString()

Xform

String Xform( xslURL )

The Gravy Framework

Documentation generated by JSDoc on Fri Mar 17 06:40:21 2006