Author: lou
Date: 2008-03-22 03:54:52 -0700 (Sat, 22 Mar 2008)
New Revision: 8346

Modified:
   openlaszlo/trunk/lps/components/rpc/ajax.lzx
Log:
Change 20080322-lou-T by [EMAIL PROTECTED] on 2008-03-22 06:51:02 AST
    in /Users/lou/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Add introductory paragraphs and code snippet from 3.4

Bugs Fixed: LPP-5658 (partial)

Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)

Tests: visual verify



Modified: openlaszlo/trunk/lps/components/rpc/ajax.lzx
===================================================================
--- openlaszlo/trunk/lps/components/rpc/ajax.lzx        2008-03-22 10:54:14 UTC 
(rev 8345)
+++ openlaszlo/trunk/lps/components/rpc/ajax.lzx        2008-03-22 10:54:52 UTC 
(rev 8346)
@@ -1,49 +1,7 @@
 <library>
-    <!--- Implements XMLHttpRequest 
-          http://developer.apple.com/internet/webcontent/xmlhttpreq.html
 
-          http://www.whatwg.org/specs/web-apps/current-work/#scripted-http
-
-    Incompatibilites with spec:
-
-    Proxied: 
-
-    SOLO:
-
-    + Cannot set HTTP headers (except maybe content-type?)
-    + Cannot access response headers
-    + Cannot send raw POST data(?)
-         - but we could eventually send verbatim XML POST data payload
-           using XML.sendAndLoad().
-           Q: Does XML.sendAndLoad() handle a single text content node
-              with no tags around it? 
-
-    + Cannot send repeated query args in a POST using LoadVars
-
-    + Username/password HTTP Auth args to send() not supported.
-      Can user/password be sent in URL? We cannot set our own auth headers in 
SOLO mode...
-
-    Questions: 
-     In the spec, when you use XMLHTTPRequest.send(string), what is it 
supposed to
-     do when the content is a string? 
-     Is it supposed to send the text verbatim as the POST content body?
-    -->
-
     <class name="XMLHttpRequest" extends="node">
 
-      <!--- readyState  Object status integer:
-          0 Uninitialised
-              The initial value. 
-          1 Open
-              The open() method has been successfully called. 
-          2 Sent
-              The send() method has been successfully called, but no data has 
yet been received. 
-          3 Receiving
-              Data is being received, but the data transfer is not yet 
complete. 
-          4 Loaded
-              The data transfer has been completed.
-
-       -->
         <attribute name="readyState" value="0" type="number"/>
 
         <!-- Event handler for an event that fires at every state change
@@ -228,8 +186,59 @@
           this.dataset.setHeader(key,val);
         </method>
 
-
-
+        <doc>
+            <tag name="shortdesc"><text>An implementation of XMLHttpRequest 
(also called "AJAX")</text></tag>
+            <text>
+                <p>This class implements the XMLHTTPRequest as <a 
href="http://developer.apple.com/internet/webcontent/xmlhttpreq.html"; 
shape="rect">
+                    specified</a> by the <a 
href="http://www.whatwg.org/specs/web-apps/current-work/#scripted-http"; 
shape="rect">WHATWG</a> consortium.</p> 
+                <p>In SOLO deployed applications, this class departs from the 
specification in these ways:</p>
+                <ul>
+                    
+                    <li>Cannot set HTTP headers</li>
+                    
+                    <li>Cannot access response headers</li>
+                    
+                    <li>Cannot send raw POST data</li>
+                    
+                    <li>Cannot send repeated query args in a POST using 
LoadVars</li>
+                    
+                    <li>Username/password Auth args to send() not 
supported</li>
+                    
+                </ul>
+                <programlisting>
+    &lt;script&gt;
+        function loadXMLDoc(url) {
+            var req = new XMLHttpRequest();
+            req.onreadystatechange = processReqChange;
+            req.open("GET", url, true);
+            req.setRequestHeader('X-Test', 'one');
+            req.setRequestHeader('X-Test', 'two');
+            req.send(null);
+        }
+        
+        function processReqChange(request) {
+            Debug.write("processReqChange: req.readyState", 
request.readyState);
+            // only if request shows "loaded"
+            if (request.readyState == 4) {
+            // only if "OK"
+        if (request.status == 200) {
+            Debug.write("arg =", request);
+            Debug.write("request.status", request.status);
+            Debug.write("request.responseText:", request.responseText);
+            Debug.write("request.responseXML:", request.responseXML);
+            Debug.write("request.getAllResponseaders:",
+            request.getAllResponseHeaders());
+        } else {
+            Debug.write("There was a problem retrieving the XML data:\n" +
+            request.statusText);
+               }
+           }
+        }
+    &lt;/script&gt;
+                </programlisting>
+            </text>
+        </doc>
+  
     </class>
 
 </library>


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to