Author: hqm
Date: 2007-06-15 14:19:10 -0700 (Fri, 15 Jun 2007)
New Revision: 5433
Added:
openlaszlo/branches/legals/test/lfc/data/testsetheaders-solo.lzx
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
openlaszlo/branches/legals/test/lfc/data/alldata.lzx
Log:
Change 20070615-hqm-a by [EMAIL PROTECTED] on 2007-06-15 12:03:56 EDT
in /cygdrive/c/users/hqm/openlaszlo/legals2
for http://svn.openlaszlo.org/openlaszlo/branches/legals
Summary: support setting of HTTP request headers in SOLO data requests
New Features:
Bugs Fixed: LPP-4135 feature request
Technical Reviewer: pbr (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Tests:
added test case to test/lfc/data/alldata.lzx
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
2007-06-15 20:05:38 UTC (rev 5432)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
2007-06-15 21:19:10 UTC (rev 5433)
@@ -111,9 +111,6 @@
LzHTTPLoader.prototype.getResponseHeader = function (key) {
}
-LzHTTPLoader.prototype.setRequestHeader = function (key, value) {
- this.headers[key] = value;
-}
// headers can be a hashtable or null
LzHTTPLoader.prototype.open = function (method, url, username, password) {
@@ -158,11 +155,6 @@
xmlrequestobj.proxied = this.lzloader.proxied;
- // TODO [hqm 2007-03-02] We don't currently do anything with
- // this.requestheaders, since there's no swf7/8 API to set them in
- // an HTTP request. Flash 9 has a totally different, more
- // Java-like network API which will support this, but we'll have a
- // different LzHTTPLoader in the flash 9 kernel.
this.xmlrequestobj = xmlrequestobj;
}
@@ -170,6 +162,7 @@
LzHTTPLoader.prototype.send = function (content) {
//Debug.write('LzHTTPLoader.prototype.send', this, this.lzloader);
this.xmlrequestobj.rawpostbody = content;
+ this.lzloader.setHeaders(this.requestheaders);
this.lzloader.requestDirectXML( this.xmlrequestobj );
}
@@ -179,7 +172,7 @@
// @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) {
+LzHTTPLoader.prototype.makeProxiedURL = function ( url, reqtype, lzt,
headers) {
var proxyurl = LzBrowser.getBaseURL( );
var qargs = {
lzt: (lzt != null) ? lzt : "xmldata",
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
2007-06-15 20:05:38 UTC (rev 5432)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
2007-06-15 21:19:10 UTC (rev 5433)
@@ -467,6 +467,10 @@
if (proxied) {
lvar.sendAndLoad(reqstr , loadobj, "POST" );
} else {
+ // get request headers from loader
+ var header;
+ var headers = loadobj.loader.requestheaders;
+
// SOLO load
if (dopost) {
//Debug.write("POST", reqstr);
@@ -475,11 +479,20 @@
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" );
}
} else {
+ for ( header in headers) {
+ lvar.addRequestHeader(header, headers[header]);
+ }
//Debug.write("GET", reqstr);
lvar.sendAndLoad(reqstr , loadobj, "GET" );
}
Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
2007-06-15 20:05:38 UTC (rev 5432)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
2007-06-15 21:19:10 UTC (rev 5433)
@@ -80,6 +80,7 @@
DeclareEvent(prototype, 'onrequest' );
DeclareEvent(prototype, 'ontimeout' );
+var requestheaders = {};
var timeout = 30000;
var doPersist = false;
var doCacheRequest = true;
@@ -337,6 +338,10 @@
this.onrequest.sendEvent(o);
}
+function setHeaders (headers) {
+ this.requestheaders = headers;
+}
+
/**
* Request a data load using Flash XML object
* @access private
Modified: openlaszlo/branches/legals/test/lfc/data/alldata.lzx
===================================================================
--- openlaszlo/branches/legals/test/lfc/data/alldata.lzx 2007-06-15
20:05:38 UTC (rev 5432)
+++ openlaszlo/branches/legals/test/lfc/data/alldata.lzx 2007-06-15
21:19:10 UTC (rev 5433)
@@ -17,6 +17,7 @@
<include href="namespace-solo.lzx"/>
<include href="whitespace.lzx"/>
<include href="testsetheaders.lzx"/>
+ <include href="testsetheaders-solo.lzx"/>
<include href="testrawpost.lzx"/>
<include href="testrawpost-solo.lzx"/>
<include href="testheaderresponse.lzx"/>
@@ -37,6 +38,7 @@
<TestTrimWhitespace/>
<TestSendHeaders/>
<TestSetHeaders/>
+ <TestSetHeadersSOLO/>
<TestRawPost/>
<TestRawPostSOLO/>
<TestResponseHeaders/>
Added: openlaszlo/branches/legals/test/lfc/data/testsetheaders-solo.lzx
Property changes on:
openlaszlo/branches/legals/test/lfc/data/testsetheaders-solo.lzx
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins