Author: hqm
Date: 2008-01-23 17:57:05 -0800 (Wed, 23 Jan 2008)
New Revision: 7880

Modified:
   openlaszlo/trunk/
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
   
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/data/HTTPDataSource.java
   openlaszlo/trunk/test/lfc/data/alldata.lzx
   openlaszlo/trunk/test/lfc/data/testsetheaders-solo.lzx
   openlaszlo/trunk/test/lfc/data/testsetheaders.lzx
Log:
Merged revisions 7872 via svnmerge from 
http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

.......
  r7872 | hqm | 2008-01-23 13:50:26 -0500 (Wed, 23 Jan 2008) | 53 lines
  
  Change 20080123-hqm-4 by [EMAIL PROTECTED] on 2008-01-23 09:36:16 EST
      in /cygdrive/c/users/hqm/openlaszlo/wafflecone
      for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
  
  
  Summary:  updated: preserve url query string with post data requests
  
  New Features:
  
  Bugs Fixed: LPP-5368
  
  Technical Reviewer: pkang
  QA Reviewer: ptw
  Doc Reviewer:
  
  Documentation:
  
  The URL which is specified as the 'src' attribute of a dataset, such as
  
  <dataset  src="http://foo.bar.com/baz.php?myarg=1"; />
  
  will be preserved in POST operations, both SOLO and proxied.
  
  All data which is set via the
  
  setQueryString
  setQueryParam
  setQueryParams
  
  will be stored in a distinct table, and will only be merged with the src url
  in the case of a GET request.
  
  For POST requests, the src full URL with its original query string will be 
sent,
  and all other param data will be sent www-form-encoded in the POST body.
  
  
  Note: raw post data via the "lzpostbody" arg turns out not to work in SOLO 
mode,
  and has never actually fully worked.
  
  
  Release Notes:
  
  Details:
  
  
  Tests:
  
  test/lfc/data/alldata.lzx DHTML/SWF
  
  amazon
  calendar proxied/solo DHTML/SWF
.......



Property changes on: openlaszlo/trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 
/openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097
 
/openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
   + /openlaszlo/branches/paperpie:1-6504,6506-6574,6576-7135,7137-7235 
/openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497,6509,6661,7097,7872
 
/openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-01-24 01:52:48 UTC 
(rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-01-24 01:57:05 UTC 
(rev 7880)
@@ -1,6 +1,6 @@
 /**
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic LFC
@@ -118,6 +118,8 @@
 
 var postbody = null;
 
+var src = null;
+
 /** When true, the server will accept
   * encoded responses for this request.  
   * Encoded responses require more work for the LPS (encoding the 
@@ -453,10 +455,7 @@
 
 /**
   * Sets the src attribute of the data request.
-  * Calling this method will cause any pre-existing query arguments to be 
discarded.
-  * If a query string is contained in the src argument, it will be used to
-  * set the query arguments of the current request.
-  * @param String src: A new src for data request.
+  * @param String src: A new src URL for data request.
 
   Need to handle these cases
   http:foo.html
@@ -467,12 +466,8 @@
   
   */
 
-
 function setSrc( src ) {
-    var url = new LzURL(src);
-    this.querystring = url.query;
-    url.query = null;
-    this.src = url.toString();
+    this.src = src;
     if ( this.autorequest ){
         this.doRequest() ;
     }
@@ -591,6 +586,38 @@
 }
 
 /**
+   Produce a hash table of key-value pairs.
+   In the case of a duplicated key, creates an array of values.
+*/
+static function queryStringToTable ( query ) {
+  var queries = {};
+  var parameters = query.split('&');
+  for (var i in parameters) {
+    var key = parameters[i];
+    var value = '';
+    var n = key.indexOf('=');
+    if (n > 0) {
+      value = unescape(key.substring(n+1));
+      key = key.substring(0, n);
+    }
+    if (key in queries) {
+        var prev = queries[key];
+        if (prev instanceof Array) {
+            prev.push(value);
+        } else {
+            value = [prev, value];
+            queries[key] = value;
+        }
+    } else {
+        queries[key] = value;
+    }
+  }
+  return queries;
+}
+
+
+
+/**
   * Does a request immediately using the current values.  If autorequest is 
true,
   * this method is called automatically when values change.
   */
@@ -610,10 +637,21 @@
     dreq.status  = dreq.READY;
     dreq.method = this.querytype;
 
-    // For back compatibility with 'lzpostbody'
+    // If this.querystring is set, use it as the source of param
+    // values. Note, this is independent of the query portion of the
+    // this.src URL. 
+    if (this.querystring) {
+        dreq.queryparams = new LzParam(this);
+        dreq.queryparams.addObject(LzParam.parseQueryString(this.querystring));
+    } else {
+        // otherwise, use the this.params value
+        dreq.queryparams = this.params;
+    }
+
+    // Support for 'lzpostbody'
     var lzpostbody = null;
-    if (this.params) {
-        lzpostbody = this.params.getValue('lzpostbody');
+    if (dreq.queryparams) {
+        lzpostbody = dreq.queryparams.getValue('lzpostbody');
     }
     if (lzpostbody != null) { 
         dreq.postbody = lzpostbody;
@@ -623,13 +661,6 @@
 
     // TODO [hqm 2007-08] does this interact with 'multirequests' flag?
     dreq.queuerequests      = this.queuerequests;
-    
-    dreq.queryparams        = this.params;
-
-    // TODO [hqm 2007-08] We didn't put 'querystring' in the dataprovider 
spec, should
-    // it be merged into queryparams somehow? 
-    dreq.querystring        = this.querystring;
-
     dreq.requestheaders     = this.headers;
     dreq.getresponseheaders = this.getresponseheaders;
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs        
2008-01-24 01:52:48 UTC (rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs        
2008-01-24 01:57:05 UTC (rev 7880)
@@ -1,6 +1,6 @@
 /**
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @access public
@@ -125,69 +125,70 @@
         }
 
         var qparams = dreq.queryparams;
-        var querystring = dreq.querystring;
 
-        // Append query params and query string into single query string
-        //Debug.debug('calling doRequest', this);
+        // Convert queryparams table into a URL-encoded query-style string
         var sep = '';
-        var q = '?';
+        var q = '';
         
-        var lzpostbody = dreq.postbody;
-
-
-        if (qparams != null) {
+        // If an explicit post body content arg wasn't supplied, make
+        // a url-form-encoded string from the queryparams data.
+        var postbody = dreq.postbody;
+        if (postbody == null && qparams != null) {
             var names = qparams.getNames();
             for ( var i in names ){
                 var name = names[i];
-                // Strip out special case key "lzpostbody", it declares a raw
-                // string content to post.
-                if (!proxied && name == 'lzpostbody') {
-                    lzpostbody = qparams.getValue(name);
-                } else {
-                    q += sep + name + '=' + 
encodeURIComponent(qparams.getValue(name));
-                    sep = '&';
-                }
+                q += sep + name + '=' + 
encodeURIComponent(qparams.getValue(name));
+                sep = '&';
             }
+            postbody = q;
         }
 
-        if (querystring != null && querystring.length > 0) {
-            q += sep + querystring;
-        }
-
-        var url = dreq.src
-            if (q == "?") {
-                // don't add empty args list
+        var lzurl = new LzURL(dreq.src);
+        
+        // For GET requests, merge in params data with URL query 
+        if (dreq.method == "GET") {
+            if (lzurl.query != null) {
+                lzurl.query = lzurl.query + "&" + postbody;
             } else {
-                // if there are already query args in the url, separate them 
with a '&'
-                if (url.indexOf('?') >= 0) {
-                    url = url + "&" + q.substring(1);
-                } else {
-                    url = url + q;
-                }
+                lzurl.query = postbody;
             }
+            postbody = null;
+        }
 
+        var cachebreak = "__lzbc__="+(new Date()).getTime();
+        // convert url back to string
+        url = lzurl.toString();
+        var url;
         if (proxied) {
             // TODO [hqm 2007-08-03] make the API for makeProxiedURL take an 
explicit host arg,
             // so we can set the proxy from user code
-            url = tloader.makeProxiedURL(url, dreq.method, "xmldata" , 
headers);
+            url = tloader.makeProxiedURL(url, dreq.method, "xmldata" , 
headers, postbody);
+            // We need to move the proxy string query data to the
+            // postbody, can't leave it in the URL string, it could be
+            // arbitrarily long.
+            var marker = url.indexOf('?');
+            var uquery = url.substring(marker+1, url.length);
+            var url_noquery = url.substring(0,marker);
+            url = url_noquery + '?' + cachebreak;
+            postbody = uquery;
+            //Debug.write("proxied req url: ", url, ', postbody: ',postbody)
         }  else {
-            // break the browser cache by creating an arg with a unique value
+            // break the browser cache by adding a unique string to the url
             if (!dreq.clientcacheable) {
-                var cachebreak = "__lzbc__="+(new Date()).getTime();
-                if (url.indexOf('?') >= 0) {
-                    url = url + "&" + cachebreak;
+                if (lzurl.query == null) {
+                    lzurl.query = cachebreak;
                 } else {
-                    url = url + "?" + cachebreak;
+                    lzurl.query += ("&" + cachebreak);
                 }
             }
-        }
 
-
+            url = lzurl.toString();
+        }
    
         dreq.status =  "loading";
         //Debug.write("calling tloader.open", proxied ? "POST" : dreq.method, 
url, "dreq.method=", dreq.method);
         tloader.open ( proxied ? "POST" : dreq.method, url, /* username */ 
null, /* password */ null);
-        tloader.send (/* content */ lzpostbody);
+        tloader.send (/* content */ postbody);
     }
 
     function loadSuccess ( loader, data ) { 
@@ -283,17 +284,8 @@
     var multirequest = false;
     var queuerequests = false;
 
-    // String value for single valued param.
-    // queryParams["aKey"] = "oneValue";
-    // Array value for a multi-value param
-    // queryParams["aKey"] = [ "value1", "value2", "value3" ]
-
     var queryparams = null; // : LzParam object
 
-    // TODO [hqm 2007-08] querystring should be merged with query params by 
the caller (lzdataset)
-    // I think..
-    var querystring = ''; // : String  
-
     var requestheaders = null; // : LzParam object
 
     var getresponsheaders = false;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs   2008-01-24 01:52:48 UTC 
(rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs   2008-01-24 01:57:05 UTC 
(rev 7880)
@@ -1,6 +1,6 @@
 /**
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @access public
@@ -59,7 +59,7 @@
   * Parse a URL query string, returns an object with key-value pairs
   * @return Object
   */
-function parseQueryString ( query ) {
+static function parseQueryString ( query ) {
   var parameters = query.split('&');
   var queries = {};
   for (var i in parameters) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js       
2008-01-24 01:52:48 UTC (rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js       
2008-01-24 01:57:05 UTC (rev 7880)
@@ -1,7 +1,7 @@
 /**
   * LzHTTPLoader.js
   *
-  * @copyright Copyright 2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -136,7 +136,7 @@
 //   @param String url: url, including query args
 //   @param  String reqtype: 'POST' or 'GET'
 //   @param Object headers: hash table of HTTP request headers
-    LzHTTPLoader.prototype.makeProxiedURL = function ( url,  reqtype, lzt, 
headers) {
+    LzHTTPLoader.prototype.makeProxiedURL = function ( url,  reqtype, lzt, 
headers, postbody) {
     var proxyurl = LzBrowser.getBaseURL( );
 
     var qargs = {
@@ -151,6 +151,12 @@
         ccache: this.options.ccache
     };
 
+    //If a postbody string is supplied, pass it to the proxy server as 
'lzpostbody' arg.
+    if (postbody != null) {
+        qargs.lzpostbody = postbody;
+    }
+
+
     // Set HTTP headers
     var hname;
     var headerString = "";

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-01-24 
01:52:48 UTC (rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-01-24 
01:57:05 UTC (rev 7880)
@@ -1,7 +1,7 @@
 /**
   * LzHTTPLoader.as
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -169,7 +169,8 @@
 //   @param  String reqtype: 'POST' or 'GET'
 //   @param  String lzt: LPS server Responder type, default is "xmldata"
 //   @param Object headers: hash table of HTTP request headers
-LzHTTPLoader.prototype.makeProxiedURL = function ( url,  reqtype, lzt, 
headers) {
+//   @param String postbody: optional, post body content
+LzHTTPLoader.prototype.makeProxiedURL = function ( url,  reqtype, lzt, 
headers, postbody) {
     var proxyurl = LzBrowser.getBaseURL( );
     var qargs = {
         lzt: (lzt != null) ? lzt : "xmldata",
@@ -182,6 +183,11 @@
         cache: this.options.cacheable,
         ccache: this.options.ccache
     };
+
+    //If a postbody string is supplied, pass it to the proxy server as 
'lzpostbody' arg.
+    if (postbody != null) {
+        qargs.lzpostbody = postbody;
+    }
             
     // Set HTTP headers
     var hname;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as  2008-01-24 
01:52:48 UTC (rev 7879)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as  2008-01-24 
01:57:05 UTC (rev 7880)
@@ -1,7 +1,7 @@
 /**
   * LzLoadQueue.as
   *
-  * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -428,78 +428,99 @@
     
     //
     /*
-      We need to reparse the query string out of the url, in order to
-      set up a LoadVars object with attributes corresponding to the query args.
+      [1] If request is PROXIED, send the URL as given, with query string 
stripped off,
+      parsed, and each arg is set as a property on the LoadVar object.
 
-      If request is proxied, just send everything via POST
+      [2] If request is SOLO:
 
-      if SOLO,
-         check if loadobj.rawpostbody exists: 
-            if yes, send XML POST of raw data as TextNode
-         else
-             send LoadVars POST or GET request with base url 
+          [3] If it is a GET request, send URL as given with query string 
stripped off,
+          parsed, and each arg is set as a property on the LoadVar object.
 
+          [4] If it is a POST request, send to URL as given including query 
string.
+            take the rawpostbody property from loadobj, parse it, and set as 
properties
+            on the LoadVars object. This is as close as we can get to doing a 
POST.
+
+            We can't really post an arbitrary raw data string. The best we 
could do would
+            be to use XML sendAndLoad with a single  XML child text node, but 
that still
+            XML-escapes the text, so it isn't really much use.
+
     */
 
-    // We're loading an XML data object.
-    // Look for optional CGI query args string
-    // We are going to send the data up using LoadVars.sendAndLoad().
-    // We fill in this LoadVars object with any query args. 
-
     var url = loadobj.url;
+    var url_noquery = url;
     var lvar = new LoadVars();
-    //Fix up URL: [A] strip and parse out query args, add them as
-    //properties to LVAR (the LoadVars object)
+    var solo = !loadobj.proxied;
+
     var marker = url.indexOf('?');
     var uquery = "";
     
-    if (marker != -1) {
-        uquery = url.substring(marker+1, url.length);
-        url = url.substring(0,marker);
+    // If it's proxied, or a SOLO GET, strip the query args from URL and set 
them as
+    // properties on LoadVars obj
+    if (loadobj.proxied || !dopost) {
+        if (marker != -1) {
+            uquery = url.substring(marker+1, url.length);
+            url_noquery = url.substring(0,marker);
 
-        var uitems = LzParam.prototype.parseQueryString(uquery);
-        for ( var key in uitems) {
-            lvar[key] = uitems[key];
+            var uitems = LzParam.parseQueryString(uquery);
+            for ( var key in uitems) {
+                lvar[key] = uitems[key];
+            }
         }
     }
 
     // convert base url to absolute path, otherwise Flash is not happy
-    var reqstr = LzBrowser.toAbsoluteURL( url, loadobj.secure );
+    var reqstr;
 
-    // request methodcases:
-    // PROXIED: always POST to LPS server
-    // SOLO: GET, POST,  (and lzpostbody special case of POST with raw content)
+    if (solo && dopost) {
+        // For a SOLO POST, request the complete URL including query args
+        reqstr = LzBrowser.toAbsoluteURL( loadobj.url, loadobj.secure );
+    } else {
+        // otherwise, get the url with the query string trimmed off
+        reqstr = LzBrowser.toAbsoluteURL( url_noquery, loadobj.secure );
+    }
+
     if (loadobj.proxied) {
+        // PROXY request: proxy parameters have been stored on
+        // rawpostbody, get them out and attach them to the LoadVars
+        // obj, to POST to LPS proxy server.
+
+        var lzpostbody = loadobj.rawpostbody;
+        // Copy the postbody data onto the LoadVars, it will be POST'ed
+        var pdata = LzParam.parseQueryString(lzpostbody);
+        for ( var key in pdata) {
+            lvar[key] = pdata[key];
+        }
+
         lvar.sendAndLoad(reqstr , loadobj, "POST" );
     } else {
-        // get request headers from loader
+        // SOLO request:
+
+        // Set any specified request headers
         var header;
         var headers = loadobj.loader.requestheaders;
 
-        // SOLO load
-        if (dopost) {
+        if (!dopost) {
+            // For a GET request, all query args have been placed on
+            // the lvar object already.
+            for ( header in headers) {
+                lvar.addRequestHeader(header, headers[header]);
+            }
+            //Debug.write("GET", reqstr);
+            lvar.sendAndLoad(reqstr , loadobj, "GET" );
+        } else {
             //Debug.write("POST", reqstr);
-            var lzpostbody = loadobj.rawpostbody
-            if (lzpostbody != null) {
-                var xmlraw = new XML();
-                var tnode = xmlraw.createTextNode(lzpostbody);
-                xmlraw.appendChild(tnode);
-                for ( header in headers) {
-                    xmlraw.addRequestHeader(header, headers[header]);
-                }
-                xmlraw.sendAndLoad(reqstr, loadobj);
-            } else {
-                for ( header in headers) {
-                    lvar.addRequestHeader(header, headers[header]);
-                }
-                lvar.sendAndLoad(reqstr , loadobj, "POST" );
+            var lzpostbody = loadobj.rawpostbody;
+            // Copy the postbody data onto the LoadVars, it will be POST'ed
+            var pdata = LzParam.parseQueryString(lzpostbody);
+            for ( var key in pdata) {
+                lvar[key] = pdata[key];
             }
-        } else {
+            
             for ( header in headers) {
                 lvar.addRequestHeader(header, headers[header]);
             }
-            //Debug.write("GET", reqstr);
-            lvar.sendAndLoad(reqstr , loadobj, "GET" );
+            //Debug.write("POST", reqstr);
+            lvar.sendAndLoad(reqstr , loadobj , "POST");
         }
     }
 }

Modified: 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/data/HTTPDataSource.java
===================================================================
--- 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/data/HTTPDataSource.java 
    2008-01-24 01:52:48 UTC (rev 7879)
+++ 
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/data/HTTPDataSource.java 
    2008-01-24 01:57:05 UTC (rev 7880)
@@ -3,7 +3,7 @@
  * 
****************************************************************************/
 
 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * J_LZ_COPYRIGHT_END *********************************************************/
 
@@ -423,32 +423,31 @@
             boolean hasQuery = (query != null && query.length() > 0);
     
             if (isPost) {
-                if (hasQuery) {
-                    final String postbodyparam = "lzpostbody=";
-                    if (query.startsWith(postbodyparam)) {
-                        // Get the unescaped query string
-                        String v = 
uri.getQuery().substring(postbodyparam.length());
-                        ((EntityEnclosingMethod)request).setRequestBody(v);
-                    } else {
-                        StringTokenizer st = new StringTokenizer(query, "&");
-                        while (st.hasMoreTokens()) {
-                            String it = st.nextToken();
-                            int i = it.indexOf("=");
-                            if (i > 0) {
-                                String n = it.substring(0, i);
-                                String v = it.substring(i + 1, it.length());
-                                // POST encodes values during request
-                                ((PostMethod)request).addParameter(n, 
URLDecoder.decode(v, "UTF-8"));
-                            } else {
-                                mLogger.warn(
-/* (non-Javadoc)
- * @i18n.test
- * @org-mes="ignoring bad token (missing '=' char) in query string: " + p[0]
- */
-                        org.openlaszlo.i18n.LaszloMessages.getMessage(
-                                HTTPDataSource.class.getName(),"051018-429", 
new Object[] {it})
-);
-                            }
+                String postbody = req.getParameter("lzpostbody");
+                // If there is a lzpostbody arg, use it as the POST request 
body,
+                // and copy the query arg from the client-supplied URL to the 
proxy request URL
+                if (postbody != null) {
+                    ((EntityEnclosingMethod)request).setRequestBody(postbody);
+                    request.setQueryString(query);
+                } else if (hasQuery) {
+                    StringTokenizer st = new StringTokenizer(query, "&");
+                    while (st.hasMoreTokens()) {
+                        String it = st.nextToken();
+                        int i = it.indexOf("=");
+                        if (i > 0) {
+                            String n = it.substring(0, i);
+                            String v = it.substring(i + 1, it.length());
+                            // POST encodes values during request
+                            ((PostMethod)request).addParameter(n, 
URLDecoder.decode(v, "UTF-8"));
+                        } else {
+                            mLogger.warn(
+                                /* (non-Javadoc)
+                                 * @i18n.test
+                                 * @org-mes="ignoring bad token (missing '=' 
char) in query string: " + p[0]
+                                 */
+                                org.openlaszlo.i18n.LaszloMessages.getMessage(
+                                    
HTTPDataSource.class.getName(),"051018-429", new Object[] {it})
+                                         );
                         }
                     }
                 }

Modified: openlaszlo/trunk/test/lfc/data/alldata.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/data/alldata.lzx  2008-01-24 01:52:48 UTC (rev 
7879)
+++ openlaszlo/trunk/test/lfc/data/alldata.lzx  2008-01-24 01:57:05 UTC (rev 
7880)
@@ -20,7 +20,7 @@
     <include href="testsetheaders-solo.lzx"/>
     <include href="testrawpost.lzx"/>
     <include href="testput.lzx"/>
-    <include href="testrawpost-solo.lzx"/>
+<!--     <include href="testrawpost-solo.lzx"/> -->
     <include href="testheaderresponse.lzx"/>
     <include href="testclientcachebreaker.lzx"/>
     <include href="sendheaders.lzx"/>
@@ -42,7 +42,10 @@
         <TestSetHeadersSOLO/>
         <TestRawPost/>
         <TestPut/>
+<!--
+    This just can't work in Flash 7/8 - the text will always be XML escaped
         <TestRawPostSOLO/>
+-->
         <TestResponseHeaders/>
 
         <TestClientCacheBreaker/>
@@ -51,6 +54,6 @@
     </TestSuite>
 </canvas>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->

Modified: openlaszlo/trunk/test/lfc/data/testsetheaders-solo.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/data/testsetheaders-solo.lzx      2008-01-24 
01:52:48 UTC (rev 7879)
+++ openlaszlo/trunk/test/lfc/data/testsetheaders-solo.lzx      2008-01-24 
01:57:05 UTC (rev 7880)
@@ -1,30 +1,31 @@
 <library>
   <include href="lzunit/lzunit.lzx" />
 
-  <dataset name="edata" src="http:echo.jsp"  proxied="false"
-           getresponseheaders="true" 
-           timeout="120000"/>
+  <dataset name="edata_solo" src="http:echo.jsp"  proxied="false"
+           getresponseheaders="true"  
+           timeout="5000"/>
 
-  <class name="TestSetHeadersSOLO" extends="TestCase">
+  <class name="TestSetHeadersSOLO" extends="TestCase" >
     <attribute name="dpready" value="false"/>
     <attribute name="t2del" value="false"/>
     <attribute name="waitcnt" value="0"/>
 
-    <datapointer xpath="edata:/echo" name="dp" 
-                 oninit="Debug.write('sending edata request'); 
parent.sendit()" />
+    <datapointer xpath="edata_solo:/echo" name="dp" 
+                 oninit="Debug.write('sending edata_solo request'); 
parent.sendit()" />
 
-    <handler reference="edata" name="ondata">
-       Debug.write('testcase got edata ondata');
+    <handler reference="edata_solo" name="ondata">
+       Debug.write('testcase got edata_solo ondata');
        this.dpready = true;
     </handler>
 
     <method name="sendit">
-      Debug.write("testsetheaders.lzx sending edata");
-      edata.setHeader("content-type", "pink-elephants/xml");
-      edata.setHeader("my-personal-header", "vanilla/with-chocolate-syrup");
-      edata.setHeader("my-other-personal-header", "milk chocolate with 
almonds");
-      edata.setQueryType("POST");
-      edata.doRequest();
+      Debug.write("testsetheaders.lzx sending edata_solo");
+      edata_solo.setHeader("content-type", "pink-elephants/xml");
+      edata_solo.setHeader("my-personal-header", 
"vanilla/with-chocolate-syrup");
+      edata_solo.setHeader("my-other-personal-header", "milk chocolate with 
almonds");
+      edata_solo.setQueryParam("flash", "has some bugs");
+      edata_solo.setQueryType("POST");
+      edata_solo.doRequest();
     </method>
 
     <method name="test1">
@@ -34,7 +35,7 @@
               this.t2del = new LzDelegate( this , 'test1' );
           }
 
-          if ( this.waitcnt++ > 1000 ){
+          if ( this.waitcnt++ > 100 ){
               fail( "testsetheaders: Didn't get async data" );
           } else {
               LzIdle.callOnIdle( this.t2del );
@@ -57,7 +58,7 @@
 
 </library>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->
 

Modified: openlaszlo/trunk/test/lfc/data/testsetheaders.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/data/testsetheaders.lzx   2008-01-24 01:52:48 UTC 
(rev 7879)
+++ openlaszlo/trunk/test/lfc/data/testsetheaders.lzx   2008-01-24 01:57:05 UTC 
(rev 7880)
@@ -21,6 +21,7 @@
     <method name="sendit">
       Debug.write("testsetheaders.lzx sending edata");
       edata.setHeader("content-type", "pink-elephants/xml");
+      edata.setQueryParam("flash8", "has bugs");
       edata.setQueryType("POST");
       edata.doRequest();
     </method>
@@ -55,7 +56,7 @@
 
 </library>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->
 


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

Reply via email to