[Laszlo-checkins] r11046 - in openlaszlo/trunk/WEB-INF/lps/lfc: core data kernel/dhtml kernel/swf9
bargull@openlaszlo.org
bargull at openlaszlo.org
Wed Sep 17 10:13:09 PDT 2008
Author: bargull
Date: 2008-09-17 10:12:57 -0700 (Wed, 17 Sep 2008)
New Revision: 11046
Added:
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataRequest.lzs
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/data/Library.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataProvider.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataRequest.lzs
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/swf9/LzHTTPLoader.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as
Log:
Change 20080917-bargull-20N by bargull at dell--p4--2-53 on 2008-09-17 02:06:12
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: another round of cleanup
New Features:
Bugs Fixed: LPP-6981
Technical Reviewer: hminsky
QA Reviewer: max
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
LzNode:
- moved setter for "data" from LzDataset to LzNode
- marked "setData" as deprecated
LzDataset:
- added src-check from LzHTTPDataProvider#doRequest to LzDataset#doRequest
- check dataRequest in LzDataset#(getLoadTime(), abort(), getResponseHeader())
- removed deprecated method "getResponseStatus"
- removed old bwcompat code for "port"
- added typing
LzParam:
- removed stale devnote comment
- moved setters to attributes
- added "getValues()" (needed for LPP-354)
LzDataRequest:
- cosmetic changes and typing
- added "LOADING" status
LzDataProvider:
- typing
- added "abortLoadForRequest()" as abstract method (required in LzDataset)
LzHTTPDataRequest:
- moved into own file
- added typing
LzHTTPDataProvider:
- cosmetic changes and typing
- moved LzHTTPDataRequest in its own file
LzHTTPLoader:
- abort current request if there's a new one (otherwise you'll get an error in swf9)
- added "baserequest" and "secureport"
- cosmetic changes, adjusted a bit to match dhtml-version
- removed listener for httpstatus, because it's only of limited use (IE Flash-Plugin only)
LzXMLParser:
- added typing
LzXMLTranslator:
- cosmetic changes
Tests:
alldata passes in swf8-9
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -48,8 +48,6 @@
// var syncNew:Boolean = null;
/** @access private */
var __LZdeferredcarr:Array = null;
- /** @access private */
- var data:* = null;
/** @access private */
var classChildren:Array = null;
@@ -1655,17 +1653,26 @@
this.$lzc$set_datapath(dp);
}
+ /** @access private */
+ var data:* = null;
+
/**
+ * @access private
+ */
+ function $lzc$set_data (v:*) :void { this.setData(v); }
+
+ /**
* Sets the datacontext for the node to the data element given as an
* argument.
* @access public
* @param LzDataElement data: The dataelement to use as the context
* @param ignore: This parameter is only used in LzDataset
+ * @deprecated Use setAttribute('data', ...) instead
*/
- function setData(data, ignore=null) {
+ function setData (data:*, ignore=null) :void {
this.data = data;
- var dp = (this.datapath != null) ? this.datapath : new LzDatapath(this);
- dp.setPointer(data);
+ var dp:LzDatapath = (this.datapath != null) ? this.datapath : new LzDatapath(this);
+ dp.setPointer(data /*cast LzDataNodeMixin*/);
if (this.ondata.ready) this.ondata.sendEvent(data);
}
@@ -1690,7 +1697,6 @@
*
* @access public
*/
-
function updateData () /*:String*/ {
return void(0);
}
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/Library.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/Library.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/Library.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -12,6 +12,7 @@
#include "data/LzDataText.lzs"
#include "data/LzDataRequest.lzs"
#include "data/LzDataProvider.lzs"
+#include "data/LzHTTPDataRequest.lzs"
#include "data/LzHTTPDataProvider.lzs"
#include "data/LzDataset.lzs"
#include "data/LzDatapointer.lzs"
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataProvider.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataProvider.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataProvider.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -30,9 +30,8 @@
* @shortdesc An abstract class to represent backend data sources.
* @lzxname dataprovider
*/
+/* abstract */ class LzDataProvider extends LzEventable {
-class LzDataProvider extends LzEventable {
-
function LzDataProvider () {
super();
}
@@ -42,9 +41,16 @@
* @access public
* @param LzDataRequest dreq: The data request to run
*/
- function doRequest ( dreq ) {
-
+ function doRequest (dreq:LzDataRequest) :void {
}
+
+ /**
+ * Interrupts any load in progress.
+ * @param LzDataRequest dreq: The data request for which to interrupt the load.
+ * @access public
+ */
+ function abortLoadForRequest (dreq:LzDataRequest) :void {
+ }
}
lz.DataProvider = LzDataProvider; // publish
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataRequest.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataRequest.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataRequest.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -16,74 +16,82 @@
* @shortdesc An abstract class to represent data requests.
* @lzxname datarequest
*/
-class LzDataRequest extends LzEventable {
-
+/* abstract */ class LzDataRequest extends LzEventable {
+
/* Status value constants */
/**
- * @type String
- * @lzxdefault "success"
- * @keywords read-only
- */
+ * @type String
+ * @lzxdefault "success"
+ * @keywords read-only
+ */
static const SUCCESS :String = 'success';
/**
- * @type String
- * @lzxdefault "timeout"
- * @keywords read-only
- */
+ * @type String
+ * @lzxdefault "timeout"
+ * @keywords read-only
+ */
static const TIMEOUT :String = 'timeout';
/**
- * @type String
- * @lzxdefault "error"
- * @keywords read-only
- */
+ * @type String
+ * @lzxdefault "error"
+ * @keywords read-only
+ */
static const ERROR :String = 'error';
/**
- * @type String
- * @lzxdefault "ready"
- * @keywords read-only
- */
+ * @type String
+ * @lzxdefault "ready"
+ * @keywords read-only
+ */
static const READY :String = 'ready';
+ /**
+ * @type String
+ * @lzxdefault "loading"
+ * @keywords read-only
+ */
+ static const LOADING :String = 'loading';
/** An optional property that's the object using the DataRequest to pass into the dataprovider's doRequest method.
- * @type Object
- */
- var requestor = null;
+ * @type Object
+ */
+ var requestor :* = null;
+
/** An object which holds the protocol-specific source to load data from
- * @type Object
- */
- var src = null;
+ * @type String
+ */
+ var src :String = null;
+
/** The timeout in milliseconds
- @type Number
- */
- var timeout = Infinity;
- /** The status, one of 'success', 'timeout', 'error', or 'ready'
- @type String
- */
- var status = null;
+ * @type Number
+ */
+ var timeout :Number = Infinity;
+
+ /** The status, one of 'success', 'timeout', 'error', 'ready' or 'loading'
+ * @type String
+ */
+ var status :String = null;
+
/** Raw data returned by request
- * @type String
- */
- var rawdata = null;
+ * @type String
+ */
+ var rawdata :String = null;
- /** Used by dataprovider to record error messages
- * @type String
- */
- var error = null;
-
+ /** Used by dataprovider to record error messages
+ * @type String
+ */
+ var error :String = null;
+
/** Sent as data or other conditions occur during the execution of this request.
- * @lzxtype event
- */
- var onstatus = LzDeclaredEvent;
-
+ * @lzxtype event
+ */
+ var onstatus :LzDeclaredEventClass = LzDeclaredEvent;
+
/**
- * The object using the DataRequest to pass into the dataprovider's doRequest method.
- * @param Object requestor: The object using the DataRequest to pass into the dataprovider's doRequest method.
- */
- function LzDataRequest (requestor = null) {
- this.requestor = requestor;
- }
-
-
+ * The object using the DataRequest to pass into the dataprovider's doRequest method.
+ * @param Object requestor: The object using the DataRequest to pass into the dataprovider's doRequest method.
+ */
+ function LzDataRequest (requestor:* = null) {
+ this.requestor = requestor;
+ }
}
lz.DataRequest = LzDataRequest; //publish
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -81,7 +81,6 @@
*
* @shortdesc An in-memory xml-style data hierarchy.
* @lzxname dataset
- * @initarg deprecated port
* @initarg secureport
* @initarg querytype
* @initarg src
@@ -97,64 +96,62 @@
static var attributes = new LzInheritedHash(LzNode.attributes);
/** @access private */
LzDataset.attributes.name = 'localdata';
-
+
/** @access private */
-static var slashPat = "/";
+static const slashPat :String = "/";
/** Holds a pointer to the DataProvider which handles data load requests for this dataset.
- * Default value is canvas.defaultdataprovider
- */
-var dataprovider;
+ * Default value is canvas.defaultdataprovider
+ */
+var dataprovider :LzDataProvider;
/** Create a new data request object for each request.
- * @type Boolean
- * @lzxdefault false
- */
-var multirequest = false;
+ * @type Boolean
+ * @lzxdefault false
+ */
+var multirequest :Boolean = false;
/** @access private */
-var dataRequest = null;
+var dataRequest :LzHTTPDataRequest = null;
/** @access private */
-var dataRequestClass = LzHTTPDataRequest;
+var dataRequestClass :Class = LzHTTPDataRequest;
/** @access private */
-var dsloadDel = null;
+var dsloadDel :LzDelegate = null;
/** @access private */
-var errorstring;
+var errorstring :String;
/** @access private */
-var reqOnInitDel;
+var reqOnInitDel :LzDelegate;
/** TCP port number to use for secure (HTTPS) requests
- * @type Number
- * @lzxtype integer
- * @lzxdefault 443
-*/
-var secureport;
+ * @type uint
+ * @lzxtype integer
+ * @lzxdefault 443
+ */
+var secureport :uint;
/** The URL of the proxy server, for proxied requests */
-var proxyurl:String = null;
+var proxyurl :String = null;
/** Sent when the dataset's request results in an error.
- * @lzxtype event
- */
-var onerror:LzDeclaredEventClass = LzDeclaredEvent;
+ * @lzxtype event
+ */
+var onerror :LzDeclaredEventClass = LzDeclaredEvent;
/** Sent when the request made by the dataset times out.
* @lzxtype event
*/
-var ontimeout:LzDeclaredEventClass = LzDeclaredEvent;
+var ontimeout :LzDeclaredEventClass = LzDeclaredEvent;
/** The numer of milliseconds to wait before the request times out, and an ontimeout event is sent.
- * @lzxtype Number
- * @type Number
- */
-var timeout = 60000;
+ * @lzxtype Number
+ * @type Number
+ */
+var timeout :Number = 60000;
/** @access private */
function $lzc$set_timeout (t:Number) :void { this.timeout = t; }
/** @access private */
-var postbody = null;
+var postbody :String = 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
@@ -164,23 +161,23 @@
* @type Boolean
* @keywords read-only
*/
-var acceptencodings = false;
+var acceptencodings :Boolean = false;
/**
- * When set to "http" or "soap", the dataset
- * interprets it's src attribute as a URL to be loaded at runtime.
- * If the "src" attribute is set to a URL (e.g., starts with "http:") then
- * the type attribute implicitly becomes "http".
- * @type String
- * @lzxtype http|soap
- * @keywords read-only
- * @devnote This is really a 'pseudo' attribute , it is handled by the tag processor phase
- */
-var type = null;
+ * When set to "http" or "soap", the dataset
+ * interprets it's src attribute as a URL to be loaded at runtime.
+ * If the "src" attribute is set to a URL (e.g., starts with "http:") then
+ * the type attribute implicitly becomes "http".
+ * @type String
+ * @lzxtype http|soap
+ * @keywords read-only
+ * @devnote This is really a 'pseudo' attribute , it is handled by the tag processor phase
+ */
+var type :String = null;
/** An LzParams object which holds query key-value pairs.
- @type LzParam
- */
+ * @type LzParam
+ */
var params :LzParam = null;
/** When true, the server will preserve namespace prefixes
@@ -190,7 +187,7 @@
* @keywords read-only
* @lzxdefault false
*/
-var nsprefix = false;
+var nsprefix :Boolean = false;
/** When true, the server will encode and
* send the HTTP response headers along with the data (defaults to false).
@@ -200,20 +197,16 @@
* @lzxtype boolean
* @keywords read-only
*/
-var getresponseheaders = false;
+var getresponseheaders :Boolean = false;
+/** HTTP request method. Value must be one of "GET" or "POST".
+ * @type String
+ * @lzxtype get|post|GET|POST
+ */
+var querytype :String = "GET";
- function LzDataset ( parent:* = null, args:* = null, children:* = null, instcall:* = null) {
- super(parent,args,children,instcall);
- }
-
-/** HTTP request method. Value must be one of "GET" or "POST".
- * @type String
- * @lzxtype get|post|GET|POST
- */
-var querytype = "GET";
/** @access private */
-function $lzc$set_querytype (v) { this.setQueryType(v); }
+function $lzc$set_querytype (v:String) :void { this.setQueryType(v); }
/** When true, the server will trim
* whitespace in the XML data (defaults to false).
@@ -221,10 +214,8 @@
* @lzxtype boolean
* @keywords final
*/
-var trimwhitespace = false;
+var trimwhitespace :Boolean = false;
-// var nodeType = LzDataElement.DOCUMENT_NODE;
-
/** When true, the server will attempt to cache
* response (defaults to false). There are security concerns
* when this field is true. When this field is true, you will usually
@@ -234,13 +225,13 @@
* @keywords read-only
* @lzxdefault false
*/
-var cacheable = false;
+var cacheable :Boolean = false;
/** When true, an argument will be added to the request string in the format
* '__lzbc__=1204685840777'. This is to prevent client caching.
* @type Boolean
*/
-var clientcacheable = true;
+var clientcacheable :Boolean = true;
/** A string to be appended to the request that
* the dataset makes.
@@ -248,36 +239,31 @@
* @lzxtype string
* @keywords read-only
*/
-var querystring = null;
+var querystring :String = null;
-/**
- * @access private
- */
-function $lzc$set_data(v) { this.setData(v); }
-
/** The source for requests made by this dataset. The value can be a pathname or an absolute or relative URL.
* If the value is a URL (starts with "http:"), the dataset will be configured to load its data at runtime.
* Otherwise, the data is included inline into the application at compile time.
* @type String
*/
-var src = null;
+var src :String = null;
+
/** @access private */
-function $lzc$set_src(src) {
+function $lzc$set_src (src:String) :void {
this.src = src;
- if ( this.autorequest ){
+ if (this.autorequest) {
this.doRequest() ;
}
}
-
/** If autorequest is true, a new request will be issued automatically when the source or query params are modified.
* @type Boolean
* @lzxdefault false
*/
-var autorequest = false;
+var autorequest :Boolean = false;
/** @access private */
-function $lzc$set_autorequest(b) {
+function $lzc$set_autorequest (b:Boolean) :void {
this.autorequest = b;
}
@@ -286,54 +272,54 @@
* @type Boolean
* @lzxtype boolean
*/
-var request = false;
+var request :Boolean = false;
+
/** @access private */
-function $lzc$set_request(b) {
+function $lzc$set_request (b:Boolean) {
this.request = b;
- if ( ! b ) return;
- if ( !this.isinited ){
- this.reqOnInitDel = new LzDelegate( this , "doRequest" ,
- this, "oninit" );
+ if (b && !this.isinited) {
+ this.reqOnInitDel = new LzDelegate(this, "doRequest", this, "oninit");
}
}
/** @access private */
-var headers = null;
+var headers :LzParam = null;
/** Proxy data requests via the proxy server. Inherits value from canvas.proxied flag.
* @type Boolean or null
* @lzxdefault null
*/
-var proxied = null;
+var proxied :* = null;
/** @access private */
-var responseheaders = null;
+var responseheaders :LzParam = null;
+/** If true, the client should ensure that each request is made, rather than just
+ * making and reporting the last request.
+ * @access private
+ */
+var queuerequests :Boolean = false;
/** @access private */
-var queuerequests = false;
-/** @access private */
-var oncanvas;
+var oncanvas :Boolean;
-
/** @access private */
-function $lzc$set_initialdata(v) { this.setInitialData(v); }
+function $lzc$set_initialdata (v:String) :void { this.setInitialData(v); }
/** @access private */
+function LzDataset (parent:* = null, args:* = null, children:* = null, instcall:* = null) {
+ super(parent, args, children, instcall);
+}
-override function construct ( parent , args ){
+/** @access private */
+override function construct (parent, args) {
this.nodeType = LzDataElement.DOCUMENT_NODE;
+ this.ownerDocument = this;
+
this.queuerequests = false; // default to false, to emulate browser default
this.oncanvas = parent == canvas || parent == null;
- // bwcompat 1.0 support for port
- if (('port' in args && args.port) && !('secureport' in args && args.secureport)) {
- 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) {
this.timeout = args.timeout;
@@ -341,7 +327,7 @@
this.timeout = canvas.dataloadtimeout;
}
- if ('dataprovider' in args && args.dataprovider) {
+ if ('dataprovider' in args && args.dataprovider) {
this.dataprovider = args.dataprovider;
} else {
this.dataprovider = canvas.defaultdataprovider;
@@ -365,15 +351,15 @@
//for compatibility with dataNode API
this.nodeName = name;
- if ( this.oncanvas ){
+ if (this.oncanvas) {
canvas[ name ] = this;
} else {
// it's local - add the parent's UID
name = this.parent.getUID() + '.' + name;
}
- if (null != canvas.datasets[name]) {
- if ($debug) {
+ if ($debug) {
+ if (canvas.datasets[name] != null) {
Debug.warn("A dataset already exists with the name '%s': %w",
name, canvas.datasets[name]);
}
@@ -385,8 +371,7 @@
/**
* Extend LzNode.destroy: remove yourself from the 97 places you
- * installed yourself (do we really need all these aliases?) and
- * destroy your datasource node if you made one for yourself.
+ * installed yourself (do we really need all these aliases?).
* @access private
*/
override function destroy () {
@@ -397,12 +382,12 @@
this.dsloadDel.unregisterAll();
}
- var name = this.name;
+ var name:String = this.name;
if (this.oncanvas) {
if (canvas[ name ] === this) {
- delete canvas [ name ];
+ delete canvas[ name ];
}
- } else {
+ } else {
name = this.parent.getUID() + '.' + name;
}
if (canvas.datasets[ name ] === this) {
@@ -416,7 +401,7 @@
* Return the src attribute of the dataset, if one was given.
* @return String: The src of attribute of the dataset
*/
-function getSrc ( ){
+function getSrc () :String {
return this.src;
}
@@ -424,7 +409,7 @@
* Returns the querystring attribute of the dataset, if there is one
* @return String: The querystring attribute of the dataset
*/
-function getQueryString (){
+function getQueryString () :String {
if (typeof(this.querystring) == 'undefined') {
return "";
} else {
@@ -446,32 +431,19 @@
}
/**
- * Returns the status of the dataset's request. Always returns 200 since the
- * server will respond with an error if the request fails.
- * @deprecated Use <code>onerror</code> or <code>ontimeout</code>
- * events instead
- */
-function getStatusCode (){
- if ( $debug ){
- Debug.info("%s.%w is deprecated. Use `onerror` and `ontimeout` events instead.",
- this, arguments.callee);
- }
- return 200;
-}
-
-/**
* Sets the data for the dataset
* @param data a LzDataElement or list of Elements
* @param headers optional HTTP response headers
* @deprecated Use setAttribute('data', ...) instead when headers is not specified.
* @access private
*/
-override function setData( data , headers = null ) {
- if ( data == null ) return;
- if (data instanceof Array) {
- this.setChildNodes( data );
+override function setData (data:*, headers/*:LzParam*/ = null) :void {
+ if (data == null) {
+ return;
+ } else if (data instanceof Array) {
+ this.setChildNodes(data);
} else {
- this.setChildNodes( [data] );
+ this.setChildNodes([data]);
}
this.data = data;
@@ -481,33 +453,33 @@
}
this.responseheaders = headers;
- if (this.ondata.ready) this.ondata.sendEvent( this );
+ if (this.ondata.ready) this.ondata.sendEvent(this);
}
/**
* Called when an error is received from the datasource.
* @access private
- * @param e: the dataset whose request resulted in error
+ * @param String e: the dataset whose request resulted in error
*/
-function gotError ( e ){
+function gotError (e:String) :void {
this.errorstring = e;
- if (this.onerror.ready) this.onerror.sendEvent( this );
+ if (this.onerror.ready) this.onerror.sendEvent(this);
}
/**
* Called when a timeout is recieved from the datasource.
* @access private
*/
-function gotTimeout (){
- if (this.ontimeout.ready) this.ontimeout.sendEvent( this );
+function gotTimeout () :void {
+ if (this.ontimeout.ready) this.ontimeout.sendEvent(this);
}
/**
* This is the shared interface with datapointer
* @access private
*/
-function getContext ( chgpkg = null){
+function getContext (chgpkg = null) :* {
return this;
}
@@ -515,7 +487,7 @@
* This is the shared interface with datapointer
* @access private
*/
-function getDataset (){
+function getDataset () :LzDataset {
return this;
}
@@ -523,8 +495,8 @@
* Returns a datapointer pointing to the root of the dataset.
* @return LzDatapointer: A datapointer that points to the root of the dataset.
*/
-function getPointer (){
- var dp = new LzDatapointer( null );
+function getPointer () :LzDatapointer {
+ var dp = new LzDatapointer(null);
dp.p = this.getContext();
return dp;
}
@@ -537,15 +509,15 @@
* @param String s: A string to be appended to any query made on behalf of
* this dataset.
*/
-function setQueryString( s ) {
+function setQueryString (s:*) :void {
this.params = null;
- if ( typeof( s ) == "object" ){
+ if (typeof( s ) == "object") {
if (s instanceof lz.Param){
this.querystring = s.toString();
} else {
- var p = new lz.Param ();
- for ( var n in s ) {
- p.setValue( n, s[n], true );
+ var p:LzParam = new lz.Param();
+ for (var n:String in s) {
+ p.setValue(n, s[n], true);
}
this.querystring = p.toString();
p.destroy();
@@ -554,7 +526,7 @@
this.querystring = s;
}
- if ( this.autorequest ) {
+ if (this.autorequest) {
this.doRequest();
}
}
@@ -563,17 +535,15 @@
* Sets the src attribute of the data request.
* @deprecated Use setAttribute('src', ...) instead.
* @param String src: A new src URL for data request.
-
- Need to handle these cases
- http:foo.html
- http:/foo/bar.html
- http:foo.ksp?q=12
- http:/foo.ksp?q=12
- http:/foo/bar.ksp?q=12
-
+ *
+ * Need to handle these cases
+ * http:foo.html
+ * http:/foo/bar.html
+ * http:foo.ksp?q=12
+ * http:/foo.ksp?q=12
+ * http:/foo/bar.ksp?q=12
*/
-
-function setSrc( src ) {
+function setSrc (src:String) :void {
if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
this.$lzc$set_src(src);
}
@@ -585,8 +555,7 @@
* initialized, if 'false', request will be direct, if 'inherit', it will inherit
* from its datasource.
*/
-
-function setProxyRequests( val ) {
+function setProxyRequests (val:String) :void {
if (typeof(val) != 'string') {
if ($debug) {
Debug.warn("arg '%w' to setProxyRequests must be a string with value 'inherit', 'true', or 'false'", val);
@@ -603,7 +572,7 @@
* initialized
* @deprecated Use setAttribute('request', ...) instead.
*/
-function setRequest( b ) {
+function setRequest(b:Boolean) :void {
if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
this.$lzc$set_request(b);
}
@@ -612,8 +581,9 @@
* Returns the number of miliseconds it took to load the dataset's request
* @return Int: Number of miliseconds it took to load the last request.
*/
-function getLoadTime( ) {
- return this.dataRequest.loadtime;
+function getLoadTime () :Number {
+ var dreq:LzHTTPDataRequest = this.dataRequest;
+ return dreq ? dreq.loadtime : 0;
}
/**
@@ -623,14 +593,14 @@
* @param String key: The name of the parameter
* @param String val: The value for the parameter
*/
-function setQueryParam( key , val ) {
+function setQueryParam (key:String, val:String) :void {
this.querystring = null;
- if ( ! this.params ){
+ if (! this.params) {
this.params = new lz.Param();
}
- this.params.setValue( key, val );
+ this.params.setValue(key, val);
- if ( this.autorequest ) {
+ if (this.autorequest) {
this.doRequest();
}
}
@@ -644,19 +614,19 @@
* method clears the query parameters.
* The key 'lzpostbody' has a specific interpretation, see setQueryType() for details.
*/
-function setQueryParams( o ) {
+function setQueryParams (obj:Object) :void {
this.querystring = null;
- if ( ! this.params ){
+ if (! this.params) {
this.params = new lz.Param();
}
- if ( o ) {
- this.params.addObject( o );
- } else if ( o == null ){
+ if (obj) {
+ this.params.addObject(obj);
+ } else if (obj == null) {
this.params.remove();
}
- if ( o && this.autorequest ) {
+ if (obj && this.autorequest) {
this.doRequest();
}
}
@@ -667,7 +637,7 @@
* @access private
* @return boolean
*/
-function isProxied ( ) {
+function isProxied () :Boolean {
// Check if the dataset has a "proxied" attribute which overrides dataset's value
if (this.proxied != null && this.proxied != "inherit") {
return (this.proxied == true); // coerce to boolean
@@ -680,39 +650,40 @@
Produce a hash table of key-value pairs.
In the case of a duplicated key, creates an array of values.
*/
-static function queryStringToTable ( query:String ) :Object {
- var queries:Object = {};
- var parameters:Array = query.split('&');
- for (var i = 0; i < parameters.length; ++i) {
- var key:String = parameters[i];
- var value:String = '';
- var n:int = 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);
+static function queryStringToTable (query:String) :Object {
+ var queries:Object = {};
+ var parameters:Array = query.split('&');
+ for (var i:int = 0; i < parameters.length; ++i) {
+ var key:String = parameters[i];
+ var value:String = '';
+ var n:int = 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 {
+ queries[key] = [prev, value];
+ }
} else {
- queries[key] = [prev, value];
+ queries[key] = value;
}
- } else {
- queries[key] = value;
}
- }
- return queries;
+ return queries;
}
-
/**
* Does a request immediately using the current values. If autorequest is true,
* this method is called automatically when values change.
*/
-function doRequest(ignore=null) {
-
+function doRequest (ignore:* = null) :void {
+ // src can be null if the dataset is loaded from initialdata
+ if (! this.src) return
+
// We try to reuse the old datarequest object, unless
// multirequest is true. If multirequest is true, we need
// a separate datarequest obj for each request.
@@ -720,7 +691,7 @@
this.dataRequest = new this.dataRequestClass(this);
}
- var dreq = this.dataRequest
+ var dreq:LzHTTPDataRequest = this.dataRequest
dreq.src = this.src;
dreq.timeout = this.timeout;
@@ -741,9 +712,8 @@
// Support for 'lzpostbody'. If this is a POST, set
// the DataRequest.postbody field to the lzpostbody value.
- //
if (this.querytype.toUpperCase() == "POST") {
- var lzpostbody = this.postbody;
+ var lzpostbody:String = this.postbody;
if (dreq.queryparams) {
// a "lzpostbody" arg overrides postbody, for back compatibility
lzpostbody = dreq.queryparams.getValue('lzpostbody');
@@ -756,7 +726,6 @@
// The Flash swf8 native API has no way to support POST of
// arbitrary raw data in SOLO mode; the best we can do is to
// send a list of url-encoded key=value pairs.
- //
if (lzpostbody != null) {
dreq.postbody = lzpostbody;
if (dreq.queryparams && dreq.queryparams.getValue('lzpostbody')) {
@@ -782,11 +751,11 @@
// NB: You had better set the onstatus event handler *before* issuing request
if (this.dsloadDel == null) {
- this.dsloadDel = new LzDelegate( this , "handleDataResponse" , dreq, "onstatus");
+ this.dsloadDel = new LzDelegate(this , "handleDataResponse" , dreq, "onstatus");
} else {
this.dsloadDel.register(dreq, "onstatus");
}
- this.dataprovider.doRequest( dreq );
+ this.dataprovider.doRequest(dreq);
}
/**
@@ -794,7 +763,7 @@
* Called when data request status changes.
* If status is 'success', call setData
*/
-function handleDataResponse (datareq) {
+function handleDataResponse (datareq:LzHTTPDataRequest) :void {
if (this.dsloadDel != null) {
this.dsloadDel.unregisterFrom(datareq.onstatus);
}
@@ -818,7 +787,7 @@
* @param b: A boolean value - true to turn on autorequest, false to turn off
* @deprecated Use setAttribute('autorequest', ...) instead.
*/
-function setAutorequest(b) {
+function setAutorequest (b:Boolean) :void {
if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
this.$lzc$set_autorequest(b);
}
@@ -827,7 +796,7 @@
* Returns an error string if there was an error, or false if there was none.
* @return String: An error string, or false if none.
*/
-function getErrorString (){
+function getErrorString () :String {
return this.errorstring;
}
@@ -837,16 +806,17 @@
* the dataset's last request
* @return LzParam: The headers from the dataset's last request
*/
-function getRequestHeaderParams ( ){
+function getRequestHeaderParams () :LzParam {
return this.headers;
}
/**
* Clears all request header parameters which were set from <method>setHeader</method>
*/
-function clearRequestHeaderParams ( ){
- if (this.headers)
+function clearRequestHeaderParams () :void {
+ if (this.headers) {
this.headers.remove();
+ }
}
/**
@@ -859,8 +829,9 @@
* are found, returns a list of values.
* @return String
*/
-function getResponseHeader(name) {
- return this.dataRequest.responseheaders[ name ];
+function getResponseHeader (name:String) :* {
+ var dreq:LzHTTPDataRequest = this.dataRequest;
+ return dreq ? dreq.responseheaders[ name ] : void(0);
}
/**
@@ -875,32 +846,35 @@
* as the raw request body (unencoded). Use of "lzpostbody" with a request
* that has more than one request parameter is undefined.
*/
-function setQueryType( reqtype ) {
- this.querytype = ( reqtype.toUpperCase() );
+function setQueryType (reqtype:String) :void {
+ this.querytype = reqtype.toUpperCase();
}
/** Sets the raw content of a POST body.
- * This replaces the old "lzpostbody" convention for passing raw POST data.
- * @param String str: The string to use as the raw POST body content
- */
-function setPostBody (str) {
+ * This replaces the old "lzpostbody" convention for passing raw POST data.
+ * @param String str: The string to use as the raw POST body content
+ */
+function setPostBody (str:String) :void {
this.postbody = str;
}
-//-----------------------------------------------------------------------------
-// Stops the load of the dataset's current request
-//-----------------------------------------------------------------------------
-function abort( ) {
- this.dataprovider.abortLoadForRequest( this.dataRequest );
+/**
+ * Stops the load of the dataset's current request
+ */
+function abort () :void {
+ var dreq:LzHTTPDataRequest = this.dataRequest;
+ if (dreq) {
+ this.dataprovider.abortLoadForRequest(dreq);
+ }
}
/**
* Returns all response headers as an object of name/value pairs, or false
* if there were none.
*
- * @return Object: A hash table object containing the response headers.
+ * @return LzParam: A hash table object containing the response headers.
*/
-function getAllResponseHeaders() {
+function getAllResponseHeaders () :LzParam {
return this.responseheaders;
}
@@ -909,20 +883,21 @@
* @param String k: Key for the header
* @param String val: Value for the header
*/
-function setHeader ( k , val ){
- if ( !this.headers ) {
+function setHeader (k:String, val:String) :void {
+ if (! this.headers) {
this.headers = new lz.Param();
}
- this.headers.setValue( k , val );
+ this.headers.setValue(k, val);
}
/** @access private */
-function setInitialData ( d ){
+function setInitialData (d:String) :void {
if (d != null) {
- var e = LzDataElement.stringToLzData(d, this.trimwhitespace, this.nsprefix);
- if (e != null)
+ var e:LzDataElement = LzDataElement.stringToLzData(d, this.trimwhitespace, this.nsprefix);
+ if (e != null) {
this.setData(e.childNodes);
+ }
}
}
@@ -960,36 +935,36 @@
* @param acceptenc: Whether to accept encodings or not - defaults to false
*/
function get (dataDel:LzDelegate = null, errorDel:LzDelegate = null, timeoutDel:LzDelegate = null, acceptenc:Boolean = false) :LzDataset {
- var d:LzDataset;
+ var dset:LzDataset;
if (this._p.length > 0) {
- d = this._p.pop();
+ dset = this._p.pop();
} else {
- d = new LzDataset(null, {name: 'LzHttpDatasetPool' + this._uid, type: 'http', acceptencodings: acceptenc});
+ dset = new LzDataset(null, {name: 'LzHttpDatasetPool' + this._uid, type: 'http', acceptencodings: acceptenc});
this._uid++;
}
- if (dataDel != null) { dataDel.register(d, 'ondata'); }
- if (errorDel != null) { errorDel.register(d, 'onerror'); }
- if (timeoutDel != null) { timeoutDel.register(d, 'ontimeout'); }
- return d;
+ if (dataDel != null) { dataDel.register(dset, 'ondata'); }
+ if (errorDel != null) { errorDel.register(dset, 'onerror'); }
+ if (timeoutDel != null) { timeoutDel.register(dset, 'ontimeout'); }
+ return dset;
}
/**
* Recyles a dataset back into the pool for reuse
* @param d: The dataset to be recycled
*/
-function recycle (d:LzDataset) :void {
+function recycle (dset:LzDataset) :void {
// clear any request-parameter stuff
- d.setQueryParams(null);
- d.setPostBody(null);
- d.clearRequestHeaderParams();
+ dset.setQueryParams(null);
+ dset.setPostBody(null);
+ dset.clearRequestHeaderParams();
// clear events
- d.ondata.clearDelegates();
- d.ontimeout.clearDelegates();
- d.onerror.clearDelegates();
+ dset.ondata.clearDelegates();
+ dset.ontimeout.clearDelegates();
+ dset.onerror.clearDelegates();
// clear any data
- d.setData([]);
+ dset.setData([]);
- this._p.push( d );
+ this._p.push(dset);
}
} // End of __LzHttpDataSetPoolClass
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -32,13 +32,13 @@
}
/** @access private
- * @param LzHTTPDataRequest dreq: The data request
- */
- function makeLoader ( dreq ) {
- var proxied = dreq.proxied;
+ * @param LzHTTPDataRequest dreq: The data request
+ */
+ function makeLoader (dreq:LzHTTPDataRequest) :LzHTTPLoader {
+ var proxied:Boolean = dreq.proxied;
// If there is no loader, or if the loader changed it's proxied
// flag, make a new loader.
- var tloader = new LzHTTPLoader(this, proxied);
+ var tloader:LzHTTPLoader = new LzHTTPLoader(this, proxied);
dreq.loader = tloader;
tloader.loadSuccess = this.loadSuccess;
tloader.loadError = this.loadError;
@@ -46,23 +46,20 @@
tloader.setProxied(proxied);
- /** TODO [hqm 2007-08] This code below to deal with secureport is likely broken,
- * I need to undersatnd what is the behavior of "secureport"
- */
+ // TODO [hqm 2007-08] This code below to deal with secureport is likely broken,
+ // I need to understand what is the behavior of "secureport"
/*************/
// TODO [pbr 2008-08-04] dreq.secure will never be null
- var secure = dreq.secure;
+ var secure:Boolean = dreq.secure;
if (secure == null) {
if (dreq.src.substring(0, 5) == "https") {
secure = true;
}
}
- if (secure) {
- tloader.baserequest = lz.Browser.getBaseURL( secure, dreq.secureport );
- //Debug.write('basereq ' + tloader.baserequest);
- }
+
tloader.secure = secure;
if (secure) {
+ tloader.baserequest = lz.Browser.getBaseURL(secure, dreq.secureport);
tloader.secureport = dreq.secureport;
}
/*************/
@@ -70,61 +67,60 @@
return tloader;
}
-
-
/**
* Interrupts any load in progress for the given dataset.
* @param LzDataRequest dreq: The data request for which to interrupt the load.
* @access public
*/
- function abortLoadForRequest( dreq ) {
- dreq.loader.abort();
+ override function abortLoadForRequest (dreq:LzDataRequest) :void {
+ (dreq cast LzHTTPDataRequest).loader.abort();
}
/**
* @access public
*/
- override function doRequest ( dreq ) {
+ override function doRequest (dreq:LzDataRequest) :void {
+ var httpdreq = dreq cast LzHTTPDataRequest;
+
// dreq.src can be null if the dataset is loaded from initialdata
- if (!dreq.src)
+ if (! httpdreq.src)
return;
//build request
- var proxied = dreq.proxied;
+ var proxied:Boolean = httpdreq.proxied;
+
// Check for previously created loader, we can reuse it
-
// TODO [hqm 2007-08] If multirequests is true, we make a new loader
// for each request. Is this correct?
- var tloader = dreq.loader;
- if ( tloader == null || dreq.multirequest == true || dreq.queuerequests == true) {
- tloader = this.makeLoader( dreq );
+ var tloader:LzHTTPLoader = httpdreq.loader;
+ if (tloader == null || httpdreq.multirequest == true || httpdreq.queuerequests == true) {
+ tloader = this.makeLoader( httpdreq );
}
- tloader.dataRequest = dreq;
+ tloader.dataRequest = httpdreq;
- tloader.setQueueing(dreq.queuerequests);
- tloader.setTimeout(dreq.timeout);
+ tloader.setQueueing(httpdreq.queuerequests);
+ tloader.setTimeout(httpdreq.timeout);
- tloader.setOption('serverproxyargs', dreq.serverproxyargs);
- tloader.setOption('cacheable', dreq.cacheable == true);
- tloader.setOption('timeout', dreq.timeout);
- tloader.setOption('trimwhitespace', dreq.trimwhitespace == true);
- tloader.setOption('nsprefix', dreq.nsprefix == true);
- tloader.setOption('sendheaders', dreq.getresponseheaders == true);
- tloader.setOption('parsexml', dreq.parsexml);
+ tloader.setOption('serverproxyargs', httpdreq.serverproxyargs);
+ tloader.setOption('cacheable', httpdreq.cacheable == true);
+ tloader.setOption('timeout', httpdreq.timeout);
+ tloader.setOption('trimwhitespace', httpdreq.trimwhitespace == true);
+ tloader.setOption('nsprefix', httpdreq.nsprefix == true);
+ tloader.setOption('sendheaders', httpdreq.getresponseheaders == true);
+ tloader.setOption('parsexml', httpdreq.parsexml);
- if ( dreq.clientcacheable != null ){
- tloader.setOption('ccache', dreq.clientcacheable);
+ if (httpdreq.clientcacheable != null) {
+ tloader.setOption('ccache', httpdreq.clientcacheable);
}
-
- var headers = {};
- var headerparams = dreq.requestheaders;
+ var headers:Object = {};
+ var headerparams:LzParam = httpdreq.requestheaders;
if (headerparams != null) {
- var headernames = headerparams.getNames();
- for (var i = 0; i < headernames.length; i++) {
- var key = headernames[i];
- var val = headerparams.getValue(key);
+ var headernames:Array = headerparams.getNames();
+ for (var i:int = 0; i < headernames.length; i++) {
+ var key:String = headernames[i];
+ var val:String = headerparams.getValue(key);
if (proxied) {
// Pass this to makeProxiedURL
headers[key] = val;
@@ -135,25 +131,21 @@
}
}
- var qparams = dreq.queryparams;
+ var qparams:LzParam = httpdreq.queryparams;
- // Convert queryparams table into a URL-encoded query-style string
- var sep = '';
- var q = '';
-
- // If an explicit post body content arg wasn't supplied, make
- // a url-form-encoded string from the queryparams data.
-
- var cachebreak = "__lzbc__="+(new Date()).getTime();
-
// Default assume we are posting query data (key-value pairs)
- var hasquerydata = true;
+ var hasquerydata:Boolean = true;
-
- var postbody = dreq.postbody;
+ // If an explicit post body content arg wasn't supplied, make
+ // a url-form-encoded string from the queryparams data.
+ var postbody:String = httpdreq.postbody;
if (postbody == null && qparams != null) {
+ // Convert queryparams table into a URL-encoded query-style string
+ var sep:String = '';
+ var q:String = '';
+
var names:Array = qparams.getNames();
- for ( var i:int = 0; i < names.length; ++i ){
+ for (var i:int = 0; i < names.length; ++i) {
var name:String = names[i];
q += sep + name + '=' + encodeURIComponent(qparams.getValue(name));
sep = '&';
@@ -167,11 +159,10 @@
tloader.setOption('hasquerydata', hasquerydata);
+ var lzurl:LzURL = new LzURL(httpdreq.src);
- var lzurl = new LzURL(dreq.src);
-
// For GET requests, merge in params data with URL query
- if (dreq.method == "GET") {
+ if (httpdreq.method == "GET") {
if (lzurl.query == null) {
lzurl.query = postbody;
} else {
@@ -182,6 +173,8 @@
postbody = null;
}
+ var cachebreak:String = "__lzbc__=" + (new Date()).getTime();
+
// [LPP-5368] If this is a SOLO POST request, with an empty
// POST body, put the 'cache-breaking' arg into this post
// body. This prevents the case of an empty POST body, which
@@ -191,30 +184,29 @@
// just SWF, in order to make things more consistent for the
// app developer; they will get this magic arg added across
// all platforms.
- if (!proxied && (dreq.method == "POST") && (postbody == null || postbody == '')) {
+ if (!proxied && (httpdreq.method == "POST") && (postbody == null || postbody == '')) {
postbody = cachebreak;
}
// convert url back to string
- var url;
+ var url:String;
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(dreq.proxyurl, lzurl.toString(), dreq.method, "xmldata" , headers, postbody);
+ url = tloader.makeProxiedURL(httpdreq.proxyurl, lzurl.toString(), httpdreq.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
// could be arbitrarily long.
- var marker = url.indexOf('?');
- var uquery = url.substring(marker+1, url.length);
- var url_noquery = url.substring(0,marker);
+ var marker:int = url.indexOf('?');
+ var uquery:String = url.substring(marker + 1, url.length);
+ var url_noquery:String = url.substring(0, marker);
url = url_noquery + '?' + cachebreak;
postbody = uquery;
-
} else {
// break the browser cache by adding a unique string to the url
- if (!dreq.clientcacheable) {
- if (dreq.method == "GET") {
+ if (! httpdreq.clientcacheable) {
+ if (httpdreq.method == "GET") {
// GET case: add to url query portion
if (lzurl.query == null) {
lzurl.query = cachebreak;
@@ -227,36 +219,39 @@
url = lzurl.toString();
}
- dreq.loadstarttime = (new Date()).getTime();
+ httpdreq.loadstarttime = (new Date()).getTime();
- dreq.status = "loading";
- tloader.open ( proxied ? "POST" : dreq.method, url, /* username */ null, /* password */ null);
+ httpdreq.status = LzDataRequest.LOADING;
+ tloader.open ( proxied ? "POST" : httpdreq.method, url, /* username */ null, /* password */ null);
tloader.send (/* content */ postbody);
}
/**
+ * callback function for LzHTTPLoader
* @access private
*/
- function loadSuccess ( loader, data ) {
- var dreq = loader.dataRequest;
+ function loadSuccess (loader:LzHTTPLoader, data:LzDataElement) :void {
+ var dreq:LzHTTPDataRequest = loader.dataRequest;
dreq.status = LzDataRequest.SUCCESS;
loader.owner.loadResponse( dreq, data );
}
/**
+ * callback function for LzHTTPLoader
* @access private
*/
- function loadError( loader, data ) {
- var dreq = loader.dataRequest;
- dreq.status = "error";
+ function loadError (loader:LzHTTPLoader, data:LzDataElement) :void {
+ var dreq:LzHTTPDataRequest = loader.dataRequest;
+ dreq.status = LzDataRequest.ERROR;
loader.owner.loadResponse( dreq, data );
}
/**
+ * callback function for LzHTTPLoader
* @access private
*/
- function loadTimeout( loader, data ) {
- var dreq = loader.dataRequest;
+ function loadTimeout (loader:LzHTTPLoader, data:LzDataElement) :void {
+ var dreq:LzHTTPDataRequest = loader.dataRequest;
dreq.loadtime = (new Date()).getTime() - dreq.loadstarttime;
dreq.status = LzDataRequest.TIMEOUT;
dreq.onstatus.sendEvent( dreq );
@@ -265,23 +260,17 @@
/**
* @access private
*/
- function setRequestError (dreq, msg) {
+ function setRequestError (dreq:LzHTTPDataRequest, msg:String) :void {
dreq.error = msg;
dreq.status = LzDataRequest.ERROR;
}
/**
* @access private
- * @param dataRequest dreq:
+ * @param LzHTTPDataRequest dreq:
* @param LzDataElement data:
*/
- function loadResponse( dreq, data ) {
- var headers = new lz.Param( );
- // build a hashtable of header values.
- // If the header is repeated, construct a list to hold
- // all its values.
- var content = null;
-
+ function loadResponse (dreq:LzHTTPDataRequest, data:LzDataElement) :void {
dreq.loadtime = (new Date()).getTime() - dreq.loadstarttime;
if (data == null) {
@@ -290,9 +279,9 @@
return;
}
- var proxied = dreq.proxied;
+ var proxied:Boolean = dreq.proxied;
- if (!dreq.parsexml) {
+ if (! dreq.parsexml) {
// TODO [hqm 2008-07] Currently, if parsexml == false, we just return the raw
// data, we do not attempt to parse out the headers (i.e.,
// do not assume the response is wrapped in
@@ -302,7 +291,7 @@
// return all proxied responses wrapped up in that format,
// but it is not being done now for RPC and other raw data users.
dreq.rawdata = dreq.loader.getResponse();
- dreq.onstatus.sendEvent(dreq);
+ dreq.onstatus.sendEvent( dreq );
return;
} else if (proxied && data.childNodes[0].nodeName == "error") {
this.setRequestError(dreq, data.childNodes[0].attributes['msg']);
@@ -310,16 +299,22 @@
return;
}
+ // build a hashtable of header values.
+ // If the header is repeated, construct a list to hold
+ // all its values.
+ var headers:LzParam = new lz.Param();
+ var content:LzDataElement = null;
+
if (proxied) {
// For proxied requests, we get back an XML wrapper
// <resulset><body>DATA</body><headers>HEADERS</headers></resultset>
// extract the headers and body below:
- var hos = (data.childNodes.length > 1 && data.childNodes[1].childNodes) ? data.childNodes[1].childNodes : null;
+ var hos:Array = (data.childNodes.length > 1 && data.childNodes[1].childNodes) ? data.childNodes[1].childNodes : null;
// get proxy metadata (header, etc) info if any
if (hos != null) {
- for ( var i = 0; i < hos.length; i++ ){
- var h = hos[i];
- if (h.attributes) headers.addValue( h.attributes.name , h.attributes.value );
+ for (var i:int = 0; i < hos.length; i++) {
+ var h:LzDataElement = hos[i];
+ if (h.attributes) headers.addValue(h.attributes.name, h.attributes.value);
}
}
if (data.childNodes[0].childNodes) content = data.childNodes[0].childNodes[0];
@@ -334,92 +329,5 @@
dreq.onstatus.sendEvent( dreq );
}
}
-lz.HTTPDataProvider = LzHTTPDataProvider; // publish
-
-/**
- * <p>
- * <class>LzHTTPDataRequest</class> implements the DataProvider interface, to support HTTP data requests.
- * </p>
- *
- * @shortdesc A class to represent HTTP data requests.
- * @lzxname httpdatarequest
- */
-
-
-class LzHTTPDataRequest extends LzDataRequest {
-
- function LzHTTPDataRequest (requestor = null) {
- super(requestor);
- }
-
- var method:String = "GET"; // : String; // GET, POST, PUT, DELETE
- var postbody:String;
- var proxied:Boolean;
- var proxyurl:String;
- var multirequest:Boolean = false;
- var queuerequests:Boolean = false;
-
- /** An LzParam object which holds query key-value pairs.
- @type LzParam
- */
- var queryparams = null; // : LzParam object
-
- /** An LzParam object which holds HTTP request headers as key-value pairs.
- @type LzParam
- */
- var requestheaders = null; // : LzParam object
-
- /** Flag to say whether proxied server should return with HTTP response metadata added.
- @type Boolean
- */
- var getresponsheaders = false;
- /** An LzParam object which holds HTTP response headers
- @type LzParam
- */
- var responseheaders = null;
-
- var getresponseheaders = null;
-
- /** Flag to say whether data is cacheable at the server
- @type Boolean
- */
- var cacheable = false;
- /** Flag to say whether data is cacheable at the client (browser)
- @type Boolean
- */
- var clientcacheable = null;
- /** Flag to say whether whitespace should be trimmed from text element data in returned XML data
- @type Boolean
- */
- var trimwhitespace = false;
- /** Flag to say whether namespace prefixes on element and attribute names is preserved in XML data
- @type Boolean
- */
- var nsprefix = false;
-
-
- /** A hashtable object of extra args to be sent along with the LPS server proxy control args. */
- var serverproxyargs = null;
-
- /** The LZX DOM element containing the loaded data */
- var xmldata = null;
- /** Time taken by load, in milliseconds
- @type Number
- */
- var loadtime = 0;
- var loadstarttime;
-
- var secure = false;
- var secureport;
-
-
- /** Flag which says if the loader should attempt to parse the response as XML */
- var parsexml:Boolean = true;
-
- // private, pointer to our lzhttploader
- /** @access private */
- var loader = null;
-
-}
-lz.HTTPDataRequest = LzHTTPDataRequest; // publish
+lz.HTTPDataProvider = LzHTTPDataProvider; // publish
Added: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataRequest.lzs
Property changes on: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataRequest.lzs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzParam.lzs 2008-09-17 17:12:57 UTC (rev 11046)
@@ -30,8 +30,7 @@
*
* @shortdesc A utility class for manipulating name-value pairs
* @devnote lz.Param objects hold onto parameters (name/value pairs) and provide methods
- * and utilities to reserialize them. They are used whenever case matters for
- * keys or parameter names (objects don't work here...)
+ * and utilities to reserialize them.
*
* @lzxname params
*/
@@ -43,9 +42,16 @@
// default separator and delimiter
/** @access private */
var delimiter :String = "&";
+
/** @access private */
+function $lzc$set_delimiter (d:String) :void { this.setDelimiter(d); }
+
+/** @access private */
var separator :String = "=";
+/** @access private */
+function $lzc$set_separator (s:String) :void { this.setSeparator(s); }
+
/**
* @access private
*/
@@ -54,6 +60,7 @@
this.d = {};
}
+
/**
* Parse a URL query string, returns an object with key-value pairs
* @return Object
@@ -74,6 +81,7 @@
return queries;
}
+
/**
* Parse a URL query string, returns an object with key-value pairs
* @return Object
@@ -86,6 +94,7 @@
return lz.Param.parseQueryString(query);
}
+
/**
* Adds a series of name/value pairs from an object
* @param Object o: An object containing name/value pairs to add
@@ -103,6 +112,7 @@
*/
function clone (arg=null) :LzParam {
if ($debug) {
+ //TODO: [20080917 anba] deprecated since 4.1 remove in 4.3+
if (arg) Debug.info("%w.%s is deprecated. Do not pass as argument to clone()", this, arguments.callee);
}
var o:LzParam = new lz.Param();
@@ -182,23 +192,31 @@
/**
+ * Get values by name
+ * @param String name: The name to look up - must evaluate to a string
+ * @return [String]: An array of values for the specified name
+ */
+function getValues (name:String) :Array? {
+ var a:Array = this.d[ name ];
+ if (a != null) {
+ return a.concat();
+ }
+}
+
+
+/**
* Get a value by name irrespective of case.
* @param String name: The name to look up - must evaluate to a string
* @return [String]: An array of values that case-insensitively match name
* @keywords deprecated
*/
function getValueNoCase (name:String) :* {
+ //TODO: [20080917 anba] deprecated since 4.2 remove in 4.3+
if ($debug) {
- Debug.info("%w.%s is deprecated.", this, arguments.callee);
+ Debug.deprecated(this, arguments.callee, this.getValues);
}
- var a:Array = this.d[ name ];
- if (a != null) {
- if (a.length == 1) {
- return a[ 0 ];
- } else {
- return a.concat();
- }
- }
+ var a:Array = this.getValues(name);
+ return a != null && a.length == 1 ? a[0] : a;
}
@@ -215,14 +233,6 @@
}
-/** @access private */
-function $lzc$set_delimiter(d:String) :void { this.setDelimiter(d); }
-
-
-/** @access private */
-function $lzc$set_separator(s:String) :void { this.setSeparator(s); }
-
-
/**
* Set delimiter string used between records in serialize();
* @param String d: String to use as delimiter
@@ -257,6 +267,7 @@
return this.serialize();
}
+
/**
* Returns a string representation using the current separator and delimiter
* @param String sep: String to use as separator
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2008-09-17 17:12:57 UTC (rev 11046)
@@ -142,12 +142,11 @@
}
LzHTTPLoader.prototype.open = function (method, url, username, password) {
- if ($debug) {
- if (this.req) {
- // TODO: what is the expected behaviour?
- // ignore the new request or cancel the previous one?
+ if (this.req) {
+ if ($debug) {
Debug.warn("pending request for id=%s", this.__loaderid);
}
+ this.abort();
}
{
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzHTTPLoader.as 2008-09-17 17:12:57 UTC (rev 11046)
@@ -18,6 +18,11 @@
import flash.xml.*;
}#
+ static const GET_METHOD:String = "GET";
+ static const POST_METHOD:String = "POST";
+ static const PUT_METHOD:String = "PUT";
+ static const DELETE_METHOD:String = "DELETE";
+
// holds list of outstanding data requests, to handle timeouts
static const activeRequests :Object = {};
static var loaderIDCounter :uint = 0;
@@ -42,14 +47,12 @@
// The URLLoader object
var loader:URLLoader = null;
- var dataRequest:LzDataRequest = null;
+ var dataRequest:LzHTTPDataRequest = null;
+ var baserequest:LzURL;
+ var secureport:uint;
- static const GET_METHOD:String = "GET";
- static const POST_METHOD:String = "POST";
- static const PUT_METHOD:String = "PUT";
- static const DELETE_METHOD:String = "DELETE";
-
public function LzHTTPLoader (owner:*, proxied:Boolean) {
+ super();
this.owner = owner;
this.options = {parsexml: true, serverproxyargs: null};
this.requestheaders = {};
@@ -79,8 +82,13 @@
// flash.events.HTTPStatusEvent docs say response headers are AIR-only
return null;
}
+
+ public function getResponseHeader (key:String) :String {
+ // There seems to be no way to get response headers in the flash.net URLLoader API
+ trace('getResponseHeader not implemented in swf9');
+ return null;
+ }
-
/* @param Object obj: A hash table of headers for the HTTP request
@access public
*/
@@ -96,15 +104,6 @@
this.requestheaders[key] = val;
}
- public function abort () :void {
- if (this.loader) {
- this.__abort = true;
- this.loader.close();
- this.loader = null;
- this.removeTimeout(this);
- }
- }
-
/* @public */
public function setOption (key:String, val:*) :void {
this.options[key] = val;
@@ -120,13 +119,11 @@
this.setOption('proxied', proxied);
}
- /* @public
- */
+ /* @public */
public function setQueryParams (qparams) :void {
}
- /* @public
- */
+ /* @public */
public function setQueryString (qstring) :void {
}
@@ -134,34 +131,48 @@
If queueRequests is true, subsequent requests will made sequentially
If queueRequests is false, subsequent requests will interrupt requests already in process
*/
-
public function setQueueing (queuing:Boolean) :void {
this.setOption('queuing', queuing);
// [todo hqm 2006-07] NYI
}
- public function getResponseHeader (key:String) :String {
- // There seems to be no way to get response headers in the flash.net URLLoader API
- trace('getResponseHeader not implemented in swf9');
- return null;
+ public function abort () :void {
+ if (this.loader) {
+ this.__abort = true;
+ this.loader.close();
+ this.loader = null;
+ this.removeTimeout(this);
+ }
}
-
// headers can be a hashtable or null
public function open (method:String, url:String, username:String = null, password:String = null) :void {
if (this.loader) {
- Debug.warn("pending request for id=%s", this.__loaderid);
+ if ($debug) {
+ Debug.warn("pending request for id=%s", this.__loaderid);
+ }
+ this.abort();
}
- loader = new URLLoader();
- loader.dataFormat = URLLoaderDataFormat.TEXT;
+ this.loader = new URLLoader();
+ this.loader.dataFormat = URLLoaderDataFormat.TEXT;
+ this.responseText = null;
+ this.responseXML = null;
+
this.__abort = false;
this.__timeout = false;
this.requesturl = url;
this.requestmethod = method;
-
}
+
+ public function send (content:String = null) :void {
+ this.loadXMLDoc(/* method */ this.requestmethod,
+ /* url */ this.requesturl,
+ /* headers */ this.requestheaders,
+ /* postbody */ content,
+ /* ignorewhite */ true);
+ }
// @access public
// @param String url: url, including query args
@@ -192,26 +203,17 @@
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?
}
// Set up a pending timeout for a loader.
- /*
- LzHTTPLoader.prototype.setupTimeout = function (obj, duration) {
- var endtime = (new Date()).getTime() + duration;
- LzHTTPLoader.activeRequests.push(obj, endtime);
- setTimeout("LzHTTPLoader.__LZcheckXMLHTTPTimeouts()", duration);
- }
- */
- public function setupTimeout (obj:LzHTTPLoader, duration:Number) :void {
+ public function setupTimeout (httploader:LzHTTPLoader, duration:Number) :void {
var endtime:Number = (new Date()).getTime() + duration;
- //obj.__loaderid = LzHTTPLoader.loaderIDCounter++;//uncomment to give LzHTTPLoader-instance a new loader-id
- var lid:uint = obj.__loaderid;
+ var lid:uint = httploader.__loaderid;
- LzHTTPLoader.activeRequests[lid] = [obj, endtime];
+ LzHTTPLoader.activeRequests[lid] = [httploader, endtime];
var callback:Function = function () {
LzHTTPLoader.__LZcheckXMLHTTPTimeouts(lid);
}
@@ -220,18 +222,18 @@
}
// Remove a loader from the timeouts list.
- public function removeTimeout (target:LzHTTPLoader) :void {
- var lid:uint = target.__loaderid;
+ public function removeTimeout (httploader:LzHTTPLoader) :void {
+ var lid:uint = httploader.__loaderid;
//Debug.write("remove timeout for id=%s", lid);
var reqarr:Array = LzHTTPLoader.activeRequests[lid];
- if (reqarr && reqarr[0] === target) {
+ if (reqarr && reqarr[0] === httploader) {
clearTimeout(reqarr[2]);
delete LzHTTPLoader.activeRequests[lid];
}
}
// Check if any outstanding requests have timed out.
- static function __LZcheckXMLHTTPTimeouts (lid) :void {
+ static function __LZcheckXMLHTTPTimeouts (lid:uint) :void {
var req:Array = LzHTTPLoader.activeRequests[lid];
if (req) {
var now:Number = (new Date()).getTime();
@@ -257,61 +259,59 @@
}
public function getElapsedTime () :Number {
- return ((new Date()).getTime() - this.gstart);
+ return ((new Date()).getTime() - this.gstart);
}
- public function send (content:String = null) :void {
- this.loadXMLDoc(/* method */ this.requestmethod,
- /* url */ this.requesturl,
- /* headers */ this.requestheaders,
- /* postbody */ content,
- /* ignorewhite */ true);
- }
-
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
- dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
private function completeHandler(event:Event):void {
// trace("completeHandler: " + event + ", target = " + event.target);
if (event.target is URLLoader) {
- // trace("completeHandler: " , this, loader);
+ //trace("completeHandler: " , this, loader);
//trace("completeHandler: bytesLoaded" , loader.bytesLoaded, 'bytesTotal', loader.bytesTotal);
//trace('typeof data:', typeof(loader.data), loader.data.length, 'parsexml=', options.parsexml);
- this.responseText = loader.data;
-
- if (this.options['parsexml']) {
- var lzxdata:LzDataElementMixin = null;
+ if (this.loader == null) {
+ // URLLoader was cleared, ignore complete event
+ } else if (this.__timeout) {
+ // request has timed out, ignore complete event
+ } else if (this.__abort) {
+ // request was cancelled, ignore complete event
+ } else {
removeTimeout(this);
-
- // Parse data into flash native XML and then convert to LFC LzDataElement tree
- try {
- if (responseText != null && options.parsexml) {
- // This is almost identical to LzXMLParser.parseXML()
- // except ignoreWhitespace comes from options
- XML.ignoreWhitespace = options.trimwhitespace;
- this.responseXML = XML(responseText);
- this.responseXML.normalize();
- lzxdata = LzXMLTranslator.copyXML(this.responseXML,
- options.trimwhitespace,
- options.nsprefix);
+
+ this.responseText = loader.data;
+ loader = null;
+
+ if (this.options['parsexml']) {
+ var lzxdata:LzDataElement = null;
+
+ // Parse data into flash native XML and then convert to LFC LzDataElement tree
+ try {
+ if (this.responseText != null) {
+ // This is almost identical to LzXMLParser.parseXML()
+ // except ignoreWhitespace comes from options
+ XML.ignoreWhitespace = options.trimwhitespace;
+ this.responseXML = XML(responseText);
+ this.responseXML.normalize();
+ lzxdata = LzXMLTranslator.copyXML(this.responseXML,
+ options.trimwhitespace,
+ options.nsprefix);
+ }
+ } catch (err) {
+ trace("caught error parsing xml", err);
+ loadError(this, null);
+ return;
}
- } catch (err) {
- trace("caught error parsing xml", err);
- loader = null;
- loadError(this, null);
- return;
+ loadSuccess(this, lzxdata);
+ } else {
+ loadSuccess(this, this.responseText);
}
-
- loader = null;
- loadSuccess(this, lzxdata);
- } else {
- loadSuccess(this, this.responseText);
}
}
}
@@ -331,10 +331,6 @@
loadError(this, null);
}
- private function httpStatusHandler(event:HTTPStatusEvent):void {
- trace("httpStatusHandler: " + event);
- }
-
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
removeTimeout(this);
@@ -342,15 +338,10 @@
loadError(this, null);
}
-
// public
// parseXML flag : if true, translate native XML tree into LzDataNode tree,
// if false, don't attempt to translate the XML (if it exists)
public function loadXMLDoc (method:String, url:String, headers:Object, postbody:String, ignorewhite:Boolean) :void {
-
- var secure:Boolean = (url.indexOf("https:") == 0);
- url = lz.Browser.toAbsoluteURL( url, secure );
-
if (this.loader == null) {
// TODO [hqm 2008-01] wonder if we should be throwing an
// exception or returning some indication that the send
@@ -358,37 +349,40 @@
// anything, but we could... or maybe at least a debugger
// message?
if ($debug) {
- Debug.write("LzHTTPLoader.send, no request to send to, has open() been called?");
+ Debug.warn("LzHTTPLoader.send, no request to send to, has open() been called?");
}
return;
}
+
+ var secure:Boolean = (url.indexOf("https:") == 0);
+ url = lz.Browser.toAbsoluteURL( url, secure );
configureListeners(this.loader);
var request:URLRequest = new URLRequest(url);
request.data = postbody;
request.method = (method == LzHTTPLoader.GET_METHOD) ? URLRequestMethod.GET : URLRequestMethod.POST;
+ //TODO: [20080916 anba] set content-type?
+ //request.contentType = "application/x-www-form-urlencoded";
- var contentType:Boolean = false;
-
- var rhArray:Array = new Array();
+ var hasContentType:Boolean = false;
for (var k:String in headers) {
request.requestHeaders.push(new URLRequestHeader(k, headers[k]));
if (k.toLowerCase() == "content-type") {
- contentType = true;
+ hasContentType = true;
}
-
}
// If no content-type for POST was explicitly specified,
// use "application/x-www-form-urlencoded"
- if ((method == "POST") && !contentType) {
+ if ((method == "POST") && !hasContentType) {
request.requestHeaders.push(
new URLRequestHeader('Content-Type', 'application/x-www-form-urlencoded'));
}
try {
- loader.load(request);
+ this.gstart = (new Date()).getTime();
+ this.loader.load(request);
// Set up the timeout
if (isFinite(this.timeout)) {
this.setupTimeout(this, this.timeout);
@@ -401,11 +395,6 @@
}
}
-
- ////////////////////////////////////////////////////////////////
- // swf-specific stuff
-
-
/*
Event Summary Defined By
complete
@@ -426,13 +415,3 @@
securityError
Dispatched if a call to URLLoader.load() attempts to load data from a server outside the security sandbox. URLLoader
*/
-
- /*
- URLLoaderDataFormat.TEXT
-
-
-
-
- */
-
-
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as 2008-09-17 17:12:57 UTC (rev 11046)
@@ -23,7 +23,7 @@
* @param boolean trimwhitespace: if true, text nodes have whitespace trimmed from start and end.
* @return nativeXMLObject: An XML DOM object native to the runtime platform
*/
-public static function parseXML( str, trimwhitespace, nsprefix ){
+public static function parseXML (str:String, trimwhitespace:Boolean, nsprefix:Boolean) :XML {
XML.ignoreWhitespace = trimwhitespace;
var xmlobj:XML = XML(str);
xmlobj.normalize();
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as 2008-09-17 17:09:24 UTC (rev 11045)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as 2008-09-17 17:12:57 UTC (rev 11046)
@@ -11,31 +11,30 @@
/**
* @shortdesc: Utility for converting native XML DOM object into LzDataNode tree
*/
-
public class LzXMLTranslator {
-static function copyXML (xmlobj:XML, trimwhitespace:Boolean, nsprefix:Boolean) :LzDataElementMixin {
+static function copyXML (xmlobj:XML, trimwhitespace:Boolean, nsprefix:Boolean) :LzDataElement {
var lfcnode:LzDataNodeMixin = copyFlashXML(xmlobj, trimwhitespace, nsprefix);
if (lfcnode == null) {
trace('LzXMLTranslator.copyXML: lfcnode.children is null', lfcnode);
}
- if ( lfcnode is LzDataText ) {
+ if (lfcnode is LzDataText) {
return null;
}
- return (lfcnode cast LzDataElementMixin);
+ return (lfcnode cast LzDataElement);
}
-static var whitespaceChars = {' ': true, '\r': true, '\n': true, '\t': true};
+static const whitespaceChars :Object = {' ': true, '\r': true, '\n': true, '\t': true};
/**
* trim whitespace from start and end of string
* @access private
*/
-static function trim( str:String ) :String {
+static function trim (str:String) :String {
var whitech:Object = whitespaceChars;
var len:int = str.length;
var sindex:int = 0;
@@ -112,7 +111,7 @@
lfcnode = new LzDataElement(nname, cattrs);
var children:XMLList = node.children();
var newchildren:Array = [];
- for (var i:int = 0; i < children.length(); i++ ) {
+ for (var i:int = 0; i < children.length(); i++) {
var child:XML = children[i];
var lfcchild:LzDataNodeMixin = copyFlashXML(child, trimwhitespace, nsprefix);
newchildren[i] = lfcchild;
@@ -122,6 +121,4 @@
return lfcnode;
}
-
} // End of LzXMLTranslator
-
More information about the Laszlo-checkins
mailing list