[Laszlo-checkins] r9714 - in openlaszlo/trunk/WEB-INF/lps: lfc/data lfc/kernel/dhtml lfc/kernel/swf lfc/kernel/swf9 lfc/services lfc/views schema
hqm@openlaszlo.org
hqm at openlaszlo.org
Tue Jun 17 08:40:58 PDT 2008
Author: hqm
Date: 2008-06-17 08:40:50 -0700 (Tue, 17 Jun 2008)
New Revision: 9714
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.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/lfc/kernel/swf/LzLoader.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzBrowser.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/trunk/WEB-INF/lps/schema/lfc.lzx
Log:
Change 20080617-hqm-L by hqm at badtzmaru.home on 2008-06-17 11:38:00 EDT
in /Users/hqm/openlaszlo/trunk4
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: add API for setting proxy server host
New Features:
Bugs Fixed: LPP-4449
Technical Reviewer: a.bargull
QA Reviewer: max
Doc Reviewer: (pending)
Documentation:
Release Notes:
The existing proxied media loader API is extended by an additional
property, proxyurl, which can be used to specify the server to use for proxied
media requests.
proxyurl can be set to a string or a function. If a string, must be an absolute URL to a proxy server.
If it is a function, it takes one argument, a target url, and must return a url of a proxy server to use.
For a view, proxyurl defaults to a function which returns the canvas value.
The default canvas.proxyurl is set to lz.Browser.getBaseURL() by default.
Datasets now also have a 'proxyurl' property, which can be set. It defaults to the canvas
value.
Details:
+ update LzLoader and LzLoadQueue to set and look for 'proxyurl' value on the
request object.
+ http loader uses canvas proxyurl value
Tests:
lfc/data/alldata.lzx (dhtml ,swf)
calendar(dhtml,swf)
amazon(dhtml,swf)
smoke
ant lztest
specifying media proxy url:
verify that this loads the image, while sending out the request to the specified proxy url
<canvas width="100%" height="80%" debug="true"
proxyurl="http://127.0.0.1:8080/trunk2/foo.lzx">
<view id="t2" resource="http://www.beartronics.com/teletype/alert_m28_b.jpg" />
</canvas>
specifying data proxy url:
<canvas width="100%" height="80%" debug="true">
<debug fontsize="12"/>
<dataset name="trunk2" src="/trunk4/test/mydata.xml" type="http"
proxyurl="http://127.0.0.1:8080/trunk2/foo.lzx"
request="true"
ondata="Debug.write('trunk2 says', this)"/>
<dataset name="trunk3" src="/trunk4/test/mydata.xml" type="http"
proxyurl="http://127.0.0.1:8080/trunk3/foo.lzx"
request="true"
ondata="Debug.write('trunk3 says', this)"/>
<dataset name="trunk4" src="/trunk4/test/mydata.xml" type="http"
proxyurl="http://127.0.0.1:8080/trunk4/foo.lzx"
request="true"
ondata="Debug.write('trunk4 says', this)"/>
</canvas>
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -129,6 +129,9 @@
*/
var secureport;
+/** The URL of the proxy server, for proxied requests */
+var proxyurl:String = null;
+
/** Sent when the dataset's request results in an error.
* @lzxtype event
*/
@@ -277,6 +280,11 @@
args.secureport = args.port;
}
+ // Default the proxyurl to the canvas value
+ if (!('proxyurl' in args)) {
+ this.proxyurl = canvas.getProxyURL();
+ }
+
this.ownerDocument = this;
if ('timeout' in args && args.timeout) {
@@ -723,6 +731,7 @@
}
dreq.proxied = this.isProxied();
+ dreq.proxyurl = this.proxyurl;
// TODO [hqm 2007-08] does this interact with 'multirequests' flag?
dreq.queuerequests = this.queuerequests;
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -193,7 +193,7 @@
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(lzurl.toString(), dreq.method, "xmldata" , headers, postbody);
+ url = tloader.makeProxiedURL(dreq.proxyurl, lzurl.toString(), 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 since it
@@ -334,12 +334,13 @@
super(requestor);
}
- var method = "GET"; // : String; // GET, POST, PUT, DELETE
- var postbody; // : String
- var proxied; // : boolean
+ var method:String = "GET"; // : String; // GET, POST, PUT, DELETE
+ var postbody:String;
+ var proxied:Boolean;
+ var proxyurl:String;
- var multirequest = false;
- var queuerequests = false;
+ var multirequest:Boolean = false;
+ var queuerequests:Boolean = false;
/** An LzParams object which holds query key-value pairs.
@type LzParam
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2008-06-17 15:40:50 UTC (rev 9714)
@@ -136,62 +136,25 @@
// @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, postbody) {
- var proxyurl = lz.Browser.getBaseURL( );
-
- var qargs = {
- lzt: (lzt != null) ? lzt : "xmldata",
- reqtype: reqtype,
+LzHTTPLoader.prototype.makeProxiedURL = function ( proxyurl, url, httpmethod, lzt, headers, postbody) {
+ var params = {
sendheaders: this.options.sendheaders,
trimwhitespace: this.options.trimwhitespace,
nsprefix: this.options.nsprefix,
- url: lz.Browser.toAbsoluteURL(url, this.secure),
timeout: this.timeout,
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;
- var headerString = "";
- if (headers != null) {
- for (hname in headers) {
- headerString += (hname + ": " + headers[hname]+"\n");
- }
- }
-
- if (headerString != "") {
- qargs['headers'] = headerString;
- }
-
-
- // break the browser cache by creating an arg with a unique value
- if (!this.options.ccache) {
- qargs.__lzbc__ = (new Date()).getTime();
- }
-
- // append query args onto url
- proxyurl += "?";
- var sep = "";
- for (var key in qargs) {
- var val = qargs[key];
- if (typeof(val) == "string") {
- val = encodeURIComponent(val);
- val = val.replace(LzDataset.slashPat, "%2F");
- }
- proxyurl += sep + key + "=" + val;
- sep = "&";
- }
- return proxyurl;
+ ccache: this.options.ccache,
+ proxyurl: proxyurl,
+ url: url,
+ secure: this.secure,
+ postbody: postbody,
+ headers: headers,
+ httpmethod: httpmethod,
+ service: lzt
+ };
+ return lz.Browser.makeProxiedURL(params);
}
-
LzHTTPLoader.prototype.send = function (content) {
this.loadXMLDoc(/* method */ this.requestmethod,
/* url */ this.requesturl,
@@ -201,9 +164,6 @@
/* parseXML */ true);
}
-
-
-
// holds list of outstanding data requests, to handle timeouts
//LzHTTPLoader.activeRequests = [];
LzHTTPLoader.activeRequests = {};
@@ -322,6 +282,7 @@
var elt = null;
var xml = __pthis__.req.responseXML;
__pthis__.responseXML = xml;
+ __pthis__.responseText = __pthis__.req.responseText;
var lzxdata = null;
if (xml != null && parsexml) {
var nodes = __pthis__.req.responseXML.childNodes;
@@ -337,8 +298,6 @@
__pthis__.options.trimwhitespace,
__pthis__.options.nsprefix);
}
-
- __pthis__.responseText = __pthis__.req.responseText;
__pthis__.removeTimeout(__pthis__);
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2008-06-17 15:40:50 UTC (rev 9714)
@@ -169,59 +169,25 @@
// @param String lzt: LPS server Responder type, default is "xmldata"
// @param Object headers: hash table of HTTP request headers
// @param String postbody: optional, post body content
-LzHTTPLoader.prototype.makeProxiedURL = function ( url, reqtype, lzt, headers, postbody) {
- var proxyurl = lz.Browser.getBaseURL( );
- var qargs = {
- lzt: (lzt != null) ? lzt : "xmldata",
- reqtype: reqtype,
+LzHTTPLoader.prototype.makeProxiedURL = function ( proxyurl, url, httpmethod, lzt, headers, postbody) {
+ var params = {
sendheaders: this.options.sendheaders,
trimwhitespace: this.options.trimwhitespace,
- nsprefix: this.options.trimwhitespace,
- url: lz.Browser.toAbsoluteURL(url, this.secure),
+ nsprefix: this.options.nsprefix,
timeout: this.timeout,
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;
- var headerString = "";
- if (headers != null) {
- for (hname in headers) {
- headerString += (hname + ": " + headers[hname]+"\n");
- }
- }
-
- if (headerString != "") {
- qargs['headers'] = headerString;
- }
-
- // break the browser cache by creating an arg with a unique value
- if (!this.options.ccache) {
- qargs.__lzbc__ = (new Date()).getTime();
- }
-
- // append query args onto url
- proxyurl += "?";
- var sep = "";
- for (var key in qargs) {
- var val = qargs[key];
- if (typeof(val) == "string") {
- val = escape(val);
- }
- proxyurl += sep + key + "=" + val;
- sep = "&";
- }
-
- return proxyurl;
+ ccache: this.options.ccache,
+ proxyurl: proxyurl,
+ url: url,
+ secure: this.secure,
+ postbody: postbody,
+ headers: headers,
+ httpmethod: httpmethod,
+ service: lzt
+ };
+ return lz.Browser.makeProxiedURL(params);
}
-
LzHTTPLoader.prototype.timeout = Infinity;
LzHTTPLoader.prototype.setTimeout = function (timeout) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoadQueue.as 2008-06-17 15:40:50 UTC (rev 9714)
@@ -335,13 +335,15 @@
*/
LzLoadQueue.loadMovieProxiedOrDirect = function (loadobj) {
var reqstr;
- if ( !loadobj.proxied ) {
+ // TODO [2008-06 hqm] We will eventually deprecate the "proxied" flag, and just use
+ // proxyurl != null to indicate that we are proxied via the PROXYURL.
+ var proxied = (loadobj.proxied || loadobj.reqobj.proxyurl);
+ if ( !proxied ) {
reqstr = lz.Browser.toAbsoluteURL(loadobj.reqobj.url, false);
} else {
-
delete loadobj.proxied;
- reqstr = lz.Browser.getBaseURL( loadobj.secure,
- loadobj.secureport ).toString();
+ reqstr = loadobj.reqobj.proxyurl;
+ delete loadobj.reqobj.proxyurl;
//fix up URL
var url = loadobj.reqobj.url;
if ( url != null) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzLoader.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -328,6 +328,7 @@
}
lmv.lzt = o.lzt;
+ o.proxyurl = canvas.getProxyURL(o.url);
if (typeof(o.proxied) != undefined && o.proxied != null) {
lmv.proxied = o.proxied;
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -163,10 +163,13 @@
}
var policy = this.owner.owner.__LZcheckProxyPolicy( req );
+ var proxyurl = this.owner.owner.getProxyURL(req);
this.proxied = policy;
o.proxied = policy;
- if (!this.proxied) {
+ if (this.proxied) {
+ o.proxyurl = proxyurl;
+ } else {
// warn for unsupported media types
if (filetype == null) {
var suffix = null;
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as 2008-06-17 15:40:50 UTC (rev 9714)
@@ -163,60 +163,31 @@
// @param String url: url, including query args
// @param String reqtype: 'POST' or 'GET'
// @param Object headers: hash table of HTTP request headers
- public function makeProxiedURL ( url:String, reqtype:String, lzt:String, headers:Object, postbody:String) :String {
- var proxyurl:String = lz.Browser.getBaseURL( ).toString();
-
- var qargs:Object = {
- lzt: (lzt != null) ? lzt : "xmldata",
- reqtype: reqtype,
+ public function makeProxiedURL( proxyurl:String,
+ url:String,
+ httpmethod:String,
+ lzt:String,
+ headers:Object,
+ postbody:String):String {
+ var params:Object = {
sendheaders: this.options.sendheaders,
trimwhitespace: this.options.trimwhitespace,
nsprefix: this.options.nsprefix,
- url: lz.Browser.toAbsoluteURL(url, this.secure),
timeout: this.timeout,
cache: this.options.cacheable,
- ccache: this.options.ccache
+ ccache: this.options.ccache,
+ proxyurl: proxyurl,
+ url: url,
+ secure: this.secure,
+ postbody: postbody,
+ headers: headers,
+ httpmethod: httpmethod,
+ service: lzt
};
-
- //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 headerString:String = "";
- if (headers != null) {
- for (var hname:String in headers) {
- headerString += (hname + ": " + headers[hname] + "\n");
- }
- }
-
- if (headerString != "") {
- qargs['headers'] = headerString;
- }
-
-
- // break the browser cache by creating an arg with a unique value
- if (!this.options.ccache) {
- qargs.__lzbc__ = (new Date()).getTime();
- }
-
- // append query args onto url
- proxyurl += "?";
- var sep:String = "";
- for (var key:String in qargs) {
- var val:* = qargs[key];
- if (typeof(val) == "string") {
- val = encodeURIComponent(val);
- val = val.replace(LzDataset.slashPat, "%2F");
- }
- proxyurl += sep + key + "=" + val;
- sep = "&";
- }
- return proxyurl;
+ return lz.Browser.makeProxiedURL(params);
}
+
public function setTimeout (timeout:Number) :void {
this.timeout = timeout;
// [todo hqm 2006-07] Should we have an API method for setting LzLoader timeout?
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzBrowser.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzBrowser.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzBrowser.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -290,6 +290,86 @@
function supportsPost (){
return true;
}
+
+ /** @access public
+ * @param Object params a hash table of key-value pairs
+ * The params arg has keys that have the following meaning:
+ * <ul>
+ * <li>url: url, including query args</li>
+ * <li>httpmethod: 'post' or 'get'</li>
+ * <li>service: 'xmldata' or 'media'</li>
+ * <li>headers: hash table of HTTP request headers</li>
+ * <li>postbody: optional, post body data string</li>
+ * <li>proxyurl: the url of the proxy server host. Should be just a path, must not contain a query string.</li>
+ * <li>nsprefix: boolean, if true preserve namespace prefixes in data response</li>
+ * <li>timeout: milliseconds for timeout</li>
+ * <li> cacheable: boolean, cache on server</li>
+ * <li> ccache: boolean, cache at client</li>
+ * <li> sendheaders: boolean, server sends back HTTP headers with data response</li>
+ * <li> secure: boolean, will be used when converting relative to absolute url, to make it https</li>
+ * <li> trimwhitespace: boolean</li>
+ *</ul>
+ */
+ public function makeProxiedURL (params:Object):String {
+ var headers:Object = params.headers;
+ var postbody:String = params.postbody;
+ var proxyurl:String = params.proxyurl;
+ var secure:Boolean = params.secure;
+ var qargs = {
+ lzt: params.service,
+ reqtype: params.httpmethod.toUpperCase(),
+ sendheaders: params.sendheaders,
+ trimwhitespace: params.trimwhitespace,
+ nsprefix: params.trimwhitespace,
+ url: this.toAbsoluteURL(params.url, params.secure),
+ timeout: params.timeout,
+ cache: params.cacheable,
+ ccache: params.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 = "";
+ if (headers != null) {
+ for (hname in headers) {
+ headerString += (hname + ": " + headers[hname]+"\n");
+ }
+ }
+
+ if (headerString != "") {
+ qargs['headers'] = headerString;
+ }
+
+ // break the browser cache by creating an arg with a unique value
+ if (!params.ccache) {
+ qargs.__lzbc__ = (new Date()).getTime();
+ }
+
+ // append query args onto url
+ var sep = "?";
+ for (var key in qargs) {
+ var val = qargs[key];
+ if (typeof(val) == "string") {
+ val = encodeURIComponent(val);
+ if ($dhtml) {
+ // workaround bug with DHTML runtime's URL encoding
+ val = val.replace(LzDataset.slashPat, "%2F");
+ }
+ }
+ proxyurl += sep + key + "=" + val;
+ sep = "&";
+ }
+
+ return proxyurl;
+ }
+
+
+
} // End of LzBrowserService
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -233,6 +233,12 @@
} else {
this.proxied = (args.proxied == true);
}
+
+ // If no explicit proxyurl defined, set the default proxyurl to our app baseurl
+ if (typeof(args.proxyurl) == "undefined") {
+ this.proxyurl = lz.Browser.getBaseURL( ).toString();
+ }
+
delete args.proxied;
if (capabilities.readcanvassizefromsprite == true) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-06-17 15:40:50 UTC (rev 9714)
@@ -415,6 +415,7 @@
this.$lzc$set_stretches(args.stretches);
args.stretches = LzNode._ignoreAttribute;
}
+
if (args['resource'] != null && (! (args.resource instanceof LzInitExpr)) ){
this.$lzc$set_resource( args.resource );
args.resource = LzNode._ignoreAttribute;
@@ -2892,8 +2893,25 @@
*/
var blurring = false;
+/** @access public
+ * @param url the url of the media resource being requested.
+ * @return returns a URL of a server through which to proxy the request
+ */
+function getProxyURL ( url = null ){
+ var proxy = this.proxyurl;
+ if (proxy == null) {
+ return null;
+ } else if (typeof(proxy) == "string") {
+ return proxy;
+ } else if (typeof(proxy) == "function") {
+ return proxy(url);
+ } else {
+ if ($debug) {
+ Debug.error("Unknown value for proxyurl expression %w on %w", proxy, this);
+ }
+ }
+}
-
/** @access private */
static var __LZproxypolicies = [];
@@ -2961,6 +2979,42 @@
var __proxypolicy = null;
/**
+ * Sets a proxy policy function on a per-view basis.
+ *
+ * @param Object f: If a string, use as a URL to the proxy server. If a function, it should take a URL of a resource, and return the URL of the proxy server to use to load that resource.
+ */
+function setProxyURL ( f ){
+ this.proxyurl = f;
+}
+
+/** @access private */
+function $lzc$set_proxyurl( f ){
+ this.setProxyURL(f);
+}
+
+
+/** The url of the proxy server, if the app is running in proxied mode.
+ *
+ * proxyurl can be null, a URL string, or a function.
+ *
+ * <ul>
+ * <li> If the value is a string, treat it a URL to the proxy server. </li>
+ * <li> If the value is a function, it should return the URL of the proxy server. </li>
+ * </ul>
+ * The default proxy policy references the proxyurl of the canvas.
+ * @type Object
+ * @lzxtype expression
+ * @lzxdefault function
+ */
+var proxyurl = function (url:String) {
+ /* TODO: It might be useful someday to implement a proxyurl
+ * function that searches up the parent chain instead of going
+ * directly to the canvas.
+ */
+ return canvas.getProxyURL(url);
+};
+
+/**
* LzView.setContextMenu
* Install menu items for the right-mouse-button
* @param LzContextMenu cmenu: LzContextMenu to install on this view
Modified: openlaszlo/trunk/WEB-INF/lps/schema/lfc.lzx
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/schema/lfc.lzx 2008-06-17 13:31:05 UTC (rev 9713)
+++ openlaszlo/trunk/WEB-INF/lps/schema/lfc.lzx 2008-06-17 15:40:50 UTC (rev 9714)
@@ -54,6 +54,7 @@
<attribute name="validate" type="boolean" value="true"/>
<!-- If true, media and data requests are proxied -->
<attribute name="proxied" type="inheritableBoolean" value="inherit"/>
+ <attribute name="proxyurl" type="string"/>
<!-- If true, enable debugging in the application -->
<attribute name="debug" type="boolean" value="false"/>
<!-- If true, enable backtraces in debugger -->
@@ -244,6 +245,7 @@
<attribute name="valign" type="string" value="top" enum="top|middle|bottom|constraint" />
<attribute name="layout" type="css"/>
<attribute name="pixellock" type="boolean" value="false"/>
+ <attribute name="proxyurl" type="string"/>
<attribute name="rotation" type="numberExpression" value="0"/>
<attribute name="xoffset" type="numberExpression" value="0"/>
<attribute name="yoffset" type="numberExpression" value="0"/>
@@ -702,6 +704,8 @@
<attribute name="timeout" type="number" />
<!-- If true, proxy data requests through a server -->
<attribute name="proxied" type="inheritableBoolean" value="inherit" />
+ <!-- URL of the proxy server. Defaults to canvas proxyurl string -->
+ <attribute name="proxyurl" type="string"/>
<!-- If this is a pathname, it specifies an XML file whose content
is compiled into the application as the value of the dataset.
If it is a URL, it specifies the location to request data from at runtime.
More information about the Laszlo-checkins
mailing list