Overview | File | Class | Tree | Index | Help
| The Gravey 2.0 Framework and AIM RIA
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.
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

    XMLreq()

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

Method Detail

### cbwrapper

    void cbwrapper()

callback wrapper method to relieve user callback from gory details of XMLHttpRequest state transition handling.

### getResponseText

    String getResponseText()

get text returned in the reply to "this" xml request

### getResponseXML

    Object getResponseXML()

get XML returned in the reply to "this" xml request

Returns:

XML DOM

### konstructor

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

Parameters:

`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

Throws:

- ErrMsg if missing required parameter(s)

### launch

    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");

### newRequestObj

    Object newRequestObj()

method to create new XMLHttpRequest object for "this" request

Returns:

"XMLHttpRequest object"

Throws:

- ErrMsg if XML Request Objects arent supported by Browser

### toString

    String toString()

method to return "this" as a human-readable string

### xform

    String xform( xslURL )

return the output from transforming the response XML with the XSL in the specified URL/filename

Throws:

- ErrMsg on fatal error

### xform2

    String xform2( xslDOM )

return the output from transforming the response XML with the XSL in the specified XSL DOM

Throws:

- ErrMsg on fatal error

Overview | File | Class | Tree | Index | Help
| The Gravey 2.0 Framework and AIM RIA
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Sun Feb 11 13:31:42 2007