[Laszlo-checkins] r3978 - in openlaszlo/branches/legals: WEB-INF/lps/lfc/kernel/dhtml WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/server/src/org/openlaszlo/data WEB-INF/lps/server/src/org/openlaszlo/xml/internal examples/javarpc lps/components/rpc/library lps/components/rpc/library/dhtml lps/components/rpc/library/swf
Max Carlson
max at openlaszlo.org
Wed Feb 28 12:58:32 PST 2007
I think you forgot to check in the change to LzHTTPLoader.js:
// If you're POST'ing, the LPS server really wants to see
// content-type = application/x-www-form-urlencoded
if (method == "POST") {
this.requestheaders['content-type'] =
'application/x-www-form-urlencoded';
}
this.__setRequestHeaders(this.req, headers);
Also, the localdata fix didn't go in yet.
if (n && n instanceof LzDataset == false && n['localdata'] instanceof
LzDataset == true) {
Just an FYI...
hqm at openlaszlo.org wrote:
> Author: hqm
> Date: 2007-02-28 12:41:00 -0800 (Wed, 28 Feb 2007)
> New Revision: 3978
>
> Added:
> openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/xml/internal/XMLRPCJSONCompiler.java
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/javarpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/namespace.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/qname.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/rpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/soap.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpcmessage.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/
> openlaszlo/branches/legals/lps/components/rpc/library/swf/javarpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/namespace.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/qname.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/rpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/soap.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpcmessage.js
> Modified:
> openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
> openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
> openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/JavaDataSource.java
> openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/XMLRPCDataSource.java
> openlaszlo/branches/legals/examples/javarpc/accentedtext.lzx
> openlaszlo/branches/legals/examples/javarpc/returnjavabean.lzx
> openlaszlo/branches/legals/examples/javarpc/returnperson.lzx
> openlaszlo/branches/legals/examples/javarpc/returnpojo.lzx
> openlaszlo/branches/legals/lps/components/rpc/library/javarpc.js
> openlaszlo/branches/legals/lps/components/rpc/library/xmlrpc.js
> Log:
> Change 20070228-daddy-2 by daddy at gigicorp on 2007-02-28 13:50:15 EST
> in /cygdrive/c/users/hqm/openlaszlo/legals
>
> Summary: XML RPC for DHTML
>
> New Features:
>
> Bugs Fixed: LPS-?
>
> Technical Reviewer: max (pending)
> QA Reviewer: (pending)
> Doc Reviewer: jrs (pending)
>
> Documentation:
>
> Release Notes:
>
> Details:
>
> This change forks off a copy of the files in lps/components/rpc/library/ into a swf and dhtml
> version. The dhtml version relies on the server sending a JSON representation of the return value.
>
> The server will send a JSON expression for normal return data, or an XML formatted error message
> for exceptions. This is the way the swf version works now.
>
> The client uses the LzHTTPLoader (XMLHTTPRequest) to make the request to the LPS server.
>
> If parseable XML is returned it indicates an error. If the XML does not show up, the raw data string
> is passed to Javascript eval(). The code path is then the same as for the swf case.
>
>
> JavaRPC does not yet work, because the server hasn't been modified to return JSON to dhtml runtimes yet. that's next...
>
>
>
> Tests:
>
> test/rpc/xmlrpc/serverenv.lzx
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -12,7 +12,7 @@
> var LzHTTPLoader = function (owner, proxied, dataset) {
> this.dataset = dataset;
> this.owner = owner;
> - this.options = {};
> + this.options = {parsexml: true};
> this.requestheaders = {};
> this.requestmethod = LzHTTPLoader.GET_METHOD;
> }
> @@ -24,14 +24,18 @@
>
> /* Returns the response as a string */
> LzHTTPLoader.prototype.getResponse = function () {
> - return this.req.responseText;
> + return this.responseText;
> }
>
> /* Returns numeric status code (200, 404, 500, etc...) */
> LzHTTPLoader.prototype.getResponseStatus = function () {
> - return this.req.status;
> + // nyi
> }
>
> +// TODO [hqm 2007-02] this is not very useful now because we are
> +// immediately null'ing out the req field as soon as the request
> +// returns, in order to assist IE in garbage collecting.
> +
> /* Returns an array of response headers */
> LzHTTPLoader.prototype.getResponseHeaders = function () {
> // [todo hqm 2006-07] this returns a string at the moment, needs to be parsed into
> @@ -39,6 +43,14 @@
> return this.req.getAllResponseHeaders();
> }
>
> +LzHTTPLoader.prototype.setRequestHeaders = function (obj) {
> + this.requestheaders = obj;
> +}
> +
> +LzHTTPLoader.prototype.setRequestHeader = function (key, val) {
> + this.requestheaders[key] = val;
> +}
> +
> LzHTTPLoader.prototype.abort = function () {
> if (this.req) {
> this.req.cancel();
> @@ -77,6 +89,9 @@
> // [todo hqm 2006-07] NYI
> }
>
> +// TODO [hqm 2007-02] this is not useful right now because we are
> +// null'ing out the req field as soon as the request returns, in order
> +// to assist IE in garbage collecting.
> LzHTTPLoader.prototype.getResponseHeader = function (key) {
> return this.req.getResponseHeader(key);
> }
> @@ -93,26 +108,16 @@
> #pragma "passThrough=true"
> this.req = window.XMLHttpRequest? new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
> }
> - var headers = "";
> - //build headers
> - for (var header in this.requestheaders) {
> - headers += (header + ": " + this.requestheaders[header]+"\n");
> - }
> - if ( headers.length ) {
> - headers += "\n";
> - }
> - this.headerstring = headers;
> this.requesturl = url;
> -
> this.requestmethod = method;
>
> }
>
> -LzHTTPLoader.prototype.makeProxiedURL = function ( url, reqtype) {
> + LzHTTPLoader.prototype.makeProxiedURL = function ( url, reqtype, lzt) {
> var proxyurl = LzBrowser.getBaseURL( );
>
> var qargs = {
> - lzt: "xmldata",
> + lzt: (lzt != null) ? lzt : "xmldata",
> reqtype: reqtype,
> sendheaders: this.options.sendheaders,
> trimwhitespace: this.options.trimwhitespace,
> @@ -147,9 +152,10 @@
> LzHTTPLoader.prototype.send = function (content) {
> this.loadXMLDoc(/* method */ this.requestmethod,
> /* url */ this.requesturl,
> - /* headers */ this.headerstring,
> + /* headers */ this.requestheaders,
> /* postbody */ content,
> - /* ignorewhite */ true);
> + /* ignorewhite */ true,
> + /* parseXML */ true);
> }
>
>
> @@ -214,31 +220,35 @@
> }
>
>
> -LzHTTPLoader.prototype.setRequestHeaders = function (xhr, headers) {
> - return;
> +LzHTTPLoader.prototype.__setRequestHeaders = function (xhr, headers) {
> if (headers != null) {
> for (var key in headers) {
> var val = headers[key];
> // This gives error in Firefox ??
> - // xhr.setRequestHeader(key, val);
> + xhr.setRequestHeader(key, val);
> }
> }
> }
>
> // public
> -LzHTTPLoader.prototype.loadXMLDoc = function (method, url, headers, postbody, ignorewhite) {
> +// parsexml flag : if true, translate native XML tree into LzDataNode tree,
> +// if false, don't attempt to translate the XML (if it exists)
> +
> +LzHTTPLoader.prototype.loadXMLDoc = function (method, url, headers, postbody, ignorewhite, parsexml) {
> if(this.req) {
> // we can't close over "this", so use another variable name.
> var __pthis__ = this;
> this.req.onreadystatechange = function () {
> if (__pthis__.req == null) { return; }
> +
> if (__pthis__.req.readyState == 4) {
> // only if "OK"
> if (__pthis__.req.status == 200 || __pthis__.req.status == 304) {
> var elt = null;
> var xml = __pthis__.req.responseXML;
> + __pthis__.responseXML = xml;
> var lzxdata = null;
> - if (xml != null) {
> + if (xml != null && parsexml) {
> var nodes = __pthis__.req.responseXML.childNodes;
> // find first content (type == 1) child node
> for (var i = 0; i < nodes.length; i++) {
> @@ -256,6 +266,8 @@
> __pthis__.responseText = __pthis__.req.responseText;
> __pthis__.removeTimeout(__pthis__);
>
> +
> +
> /**** DEBUGGING
> var xmlSerializer = new XMLSerializer();
> var markup = xmlSerializer.serializeToString(elt);
> @@ -270,8 +282,8 @@
> }
> }
> };
> - this.setRequestHeaders(this.req, headers);
> this.req.open(method, url, true);
> + this.__setRequestHeaders(this.req, headers);
> this.req.send(postbody);
> }
> // Set up the timeout
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -66,6 +66,14 @@
> // nyi
> }
>
> +LzHTTPLoader.prototype.setRequestHeaders = function (obj) {
> + this.requestheaders = obj;
> +}
> +
> +LzHTTPLoader.prototype.setRequestHeader = function (key, val) {
> + this.requestheaders[key] = val;
> +}
> +
> LzHTTPLoader.prototype.abort = function () {
> // nyi
> }
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/JavaDataSource.java
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/JavaDataSource.java 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/JavaDataSource.java 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -3,7 +3,7 @@
> * ****************************************************************************/
>
> /* J_LZ_COPYRIGHT_BEGIN *******************************************************
> -* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * J_LZ_COPYRIGHT_END *********************************************************/
>
> @@ -192,6 +192,7 @@
> );
>
> int swfversion = LPS.getSWFVersionNum(req);
> + String runtime = req.getParameter("lzr");
>
> if (! req.getMethod().equals("POST"))
> return compileFault(
>
> Modified: openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/XMLRPCDataSource.java
> ===================================================================
> --- openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/XMLRPCDataSource.java 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/data/XMLRPCDataSource.java 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -3,7 +3,7 @@
> * ****************************************************************************/
>
> /* J_LZ_COPYRIGHT_BEGIN *******************************************************
> -* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * J_LZ_COPYRIGHT_END *********************************************************/
>
> @@ -63,7 +63,8 @@
> XMLRPCDataSource.class.getName(),"051018-62")
> );
>
> - int swfversion = LPS.getSWFVersionNum(req);
> + String runtime = req.getParameter("lzr");
> +
> try {
> if (! req.getMethod().equals("POST"))
> return compileFault(
> @@ -73,7 +74,7 @@
> */
> org.openlaszlo.i18n.LaszloMessages.getMessage(
> XMLRPCDataSource.class.getName(),"051018-74")
> -, swfversion);
> +, runtime);
>
> String url = getHTTPURL(getURL(req));
> if (url == null) {
> @@ -84,7 +85,7 @@
> */
> org.openlaszlo.i18n.LaszloMessages.getMessage(
> XMLRPCDataSource.class.getName(),"051018-85", new Object[] {url})
> -, swfversion);
> +, runtime);
> }
>
> String postbody = req.getParameter("lzpostbody");
> @@ -97,14 +98,15 @@
> mXMLRPCLoad.increment();
> try {
> Data data = HTTPDataSource.getHTTPData(req, res, url, -1);
> - return new XMLRPCData(data.getAsString().getBytes(), swfversion);
> + mLogger.error("xmlrpc data "+ data.getAsString());
> + return new XMLRPCData(data.getAsString().getBytes(), runtime);
> } finally {
> t1 = System.currentTimeMillis();
> mXMLRPCLoad.decrement((int)(t1-t0));
> }
>
> } catch (Exception e) {
> - return compileFault(e, swfversion);
> + return compileFault(e, runtime);
> }
> }
>
> @@ -118,20 +120,29 @@
> /**
> * Compile fault exception message.
> */
> - Data compileFault(Exception e, int swfversion) {
> + Data compileFault(Exception e, String runtime) {
> mLogger.error("compileFault", e);
> - return compileFault(e.getMessage(), swfversion);
> + return compileFault(e.getMessage(), runtime);
> }
>
> /**
> * Compile fault response.
> */
> - Data compileFault(String mesg, int swfversion) {
> + Data compileFault(String mesg, String runtime) {
> mLogger.error("compileFault mesg: " + mesg);
> try {
> - byte[] d = XMLRPCCompiler.compileFault(XMLUtils.escapeXml(mesg),
> - swfversion);
> - return new XMLRPCData().setResult(d);
> +
> + if ("dhtml".equals(runtime)) {
> + byte[] d = XMLRPCJSONCompiler.compileFault(XMLUtils.escapeXml(mesg),
> + runtime);
> + return new XMLRPCData().setResult(d);
> + } else {
> + int swfversion = LPS.getSWFVersionNum(runtime);
> + byte[] d = XMLRPCCompiler.compileFault(XMLUtils.escapeXml(mesg),
> + swfversion);
> + return new XMLRPCData().setResult(d);
> + }
> +
> } catch (Exception e) {
> mLogger.error("Exception", e);
> // this is an error since we can't build a fault response
> @@ -162,10 +173,16 @@
>
> public XMLRPCData() { }
>
> - public XMLRPCData(byte[] result, int swfversion)
> + public XMLRPCData(byte[] result, String runtime)
> throws IOException {
> InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(result));
> - mResult = XMLRPCCompiler.compile(reader, result.length, swfversion);
> + mLogger.debug("XMLRPCData runtime="+runtime);
> + if ("dhtml".equals(runtime)) {
> + mResult = XMLRPCJSONCompiler.compile(reader, runtime);
> + } else {
> + int swfversion = LPS.getSWFVersionNum(runtime);
> + mResult = XMLRPCCompiler.compile(reader, result.length, swfversion);
> + }
> }
>
> public String getMimeType() {
>
> Added: openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/xml/internal/XMLRPCJSONCompiler.java
>
>
> Property changes on: openlaszlo/branches/legals/WEB-INF/lps/server/src/org/openlaszlo/xml/internal/XMLRPCJSONCompiler.java
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Modified: openlaszlo/branches/legals/examples/javarpc/accentedtext.lzx
> ===================================================================
> --- openlaszlo/branches/legals/examples/javarpc/accentedtext.lzx 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/examples/javarpc/accentedtext.lzx 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -16,7 +16,7 @@
> </allow>
> </security>
>
> - <javarpc name="accented" scope="none" classname="examples.AccentedTextExample">
> + <javarpc name="accented" scope="none" remoteclassname="examples.AccentedTextExample">
> <method event="onload">
> Debug.write('proxy:');
> Debug.inspect(this.proxy);
> @@ -72,7 +72,7 @@
>
> </canvas>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
> <!-- @LZX_VERSION@ -->
>
> Modified: openlaszlo/branches/legals/examples/javarpc/returnjavabean.lzx
> ===================================================================
> --- openlaszlo/branches/legals/examples/javarpc/returnjavabean.lzx 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/examples/javarpc/returnjavabean.lzx 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -18,7 +18,7 @@
>
> <!-- Java source and class file can be found in WEB-INF/class/examples -->
> <javarpc name="returnjavabean" scope="none" objectreturntype="javabean"
> - classname="examples.ReturnJavaBeanExample">
> + remoteclassname="examples.ReturnJavaBeanExample">
> <method event="onload">
> Debug.write('proxy:');
> Debug.inspect(this.proxy);
> @@ -43,7 +43,7 @@
>
> </canvas>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
> <!-- @LZX_VERSION@ -->
>
> Modified: openlaszlo/branches/legals/examples/javarpc/returnperson.lzx
> ===================================================================
> --- openlaszlo/branches/legals/examples/javarpc/returnperson.lzx 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/examples/javarpc/returnperson.lzx 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -16,7 +16,7 @@
> </allow>
> </security>
>
> - <javarpc name="returnperson" scope="none" classname="examples.ReturnPersonExample">
> + <javarpc name="returnperson" scope="none" remoteclassname="examples.ReturnPersonExample">
> <method event="onload">
> Debug.write('proxy:');
> Debug.inspect(this.proxy);
> @@ -50,7 +50,7 @@
>
> </canvas>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
> <!-- @LZX_VERSION@ -->
>
> Modified: openlaszlo/branches/legals/examples/javarpc/returnpojo.lzx
> ===================================================================
> --- openlaszlo/branches/legals/examples/javarpc/returnpojo.lzx 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/examples/javarpc/returnpojo.lzx 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -18,7 +18,7 @@
>
> <!-- Java source and class file can be found in WEB-INF/class/examples -->
> <javarpc name="returnpojo" scope="none" objectreturntype="pojo"
> - classname="examples.ReturnPOJOExample">
> + remoteclassname="examples.ReturnPOJOExample">
> <method event="onload">
> Debug.write('proxy:');
> Debug.inspect(this.proxy);
> @@ -39,7 +39,7 @@
>
> </canvas>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
> <!-- @LZX_VERSION@ -->
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/javarpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/javarpc.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/namespace.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/namespace.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/qname.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/qname.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/rpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/rpc.js
> ___________________________________________________________________
> Name: svn:executable
> + *
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/soap.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/soap.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpc.js
> ___________________________________________________________________
> Name: svn:executable
> + *
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpcmessage.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/dhtml/xmlrpcmessage.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Modified: openlaszlo/branches/legals/lps/components/rpc/library/javarpc.js
> ===================================================================
> --- openlaszlo/branches/legals/lps/components/rpc/library/javarpc.js 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/lps/components/rpc/library/javarpc.js 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -1,174 +1,14 @@
> <library>
> -<include href="xmlrpcmessage.js" />
> -<include href="rpc.js" />
> -<script when="immediate">
> -<![CDATA[
> + <switch>
> + <when runtime="dhtml">
> + <include href="dhtml/javarpc.js" />
> + </when>
> + <otherwise>
> + <include href="swf/javarpc.js" />
> + </otherwise>
> + </switch>
>
>
> -/* LZ_COPYRIGHT_BEGIN */
> -/****************************************************************************
> - * Copyright (c) 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> - * Use is subject to license terms *
> - ****************************************************************************/
> -/* LZ_COPYRIGHT_END */
> -
> -//======================================================================
> -// DEFINE OBJECT: LzJavaRPC
> -//
> -// Implements an object to make remote java direct and XMLRPC calls.
> -//======================================================================
> -class LzJavaRPC extends LzRPC {
> -
> -//------------------------------------------------------------------------------
> -// Get object from server.
> -//
> -// @param LzDelegate delegate: delegate to call when object is returned.
> -// @param String scope: object scope. one of 'session', 'webapp', or
> -// 'static'.
> -// @param String classname: class of object to get.
> -// @param String oname: remote object name. Static objects ignore this value.
> -// @param Boolean secure: if true, make secure request.
> -// @param Integer secureport: port to use for secure request. This is ignored if
> -// secure is false.
> -// @return sequence number of request.
> -//------------------------------------------------------------------------------
> -function loadObject (delegate, opts, secure, secureport) {
> -
> - var classname = opts['classname'];
> - var mesg = new _root.XMLRPCMessage(classname + ".__LZload");
> -
> - var params = opts['params'];
> - if (params) {
> - for (var i=0; i < params.length; i++) {
> - mesg.addParameter(_root.LzBrowser.xmlEscape(params[i]));
> - }
> - }
> -
> - var o = this.__LZgetBasicLoadParams('POST');
> -
> - // op=get: just load an object if it exists, else server returns error
> - // op=create: create an object if it doesn't exist, else load it. If
> - // op=create&clobber=1, then always create an object.
> - var lo = opts['loadoption'];
> - if ( lo == 'create' ) {
> - o['op'] = 'create';
> - o['clobber'] = 1;
> - } else if ( lo == 'loadonly' ) {
> - o['op'] = 'get';
> - } else if ( lo == 'loadcreate' ) {
> - o['op'] = 'create';
> - } else {
> - _root.Debug.write('LzJavaRPC.loadObject ERROR: no such op ', lo);
> - return;
> - }
> -
> - o['url'] = 'java://' + classname;
> - o['handler'] = classname;
> - o['oname'] = opts['oname'];
> - o['scope'] = opts['scope'];
> - o['lzpostbody'] = mesg.xml();
> -
> - o.opinfo = {};
> -
> - return this.request( o, delegate, secure, secureport );
> -}
> -
> -
> -//------------------------------------------------------------------------------
> -// Remove remote object. If session object, remove and remove object from
> -// session. If web application object, remove and remove object from
> -// web application.
> -//
> -// @param LzDelegate delegate: delegate to call when result from remove call is
> -// received.
> -// @param Object opts:
> -// classname, oname, scope XXXX write API doc here
> -// @param Boolean secure: if true, make secure request.
> -// @param Integer secureport: port to use for secure request. This is ignored if
> -// secure is false.
> -// @return sequence number of request.
> -//------------------------------------------------------------------------------
> -function unloadObject (delegate, opts, secure, secureport) {
> -
> - var classname = opts['classname'];
> - var oname = opts['oname'];
> - var scope = opts['scope'];
> -
> - var mesg = new _root.XMLRPCMessage(classname + ".__LZunload");
> - var o = this.__LZgetBasicLoadParams('POST');
> - o['op'] = "destroy";
> - o['url'] = 'java://' + opts['classname'];
> - o['handler'] = classname;
> - o['oname'] = oname;
> - o['scope'] = scope;
> - o['lzpostbody'] = mesg.xml();
> -
> - return this.request( o, delegate, secure, secureport );
> -}
> -
> -
> -//------------------------------------------------------------------------------
> -// Make remote request. Data will be the return value of the remote method
> -// call, e.g., string, integer, array, struct, etc. Errors are returned like:
> -//
> -// { status: STATUS, message: MESSAGE }
> -//
> -// where STATUS is one of 'ok' or 'error'.
> -//
> -// @param LzDelegate delegate: delegate to call when object is returned.
> -// @param Array args: array of argument parameters for remote function.
> -// @param Object opts: options to add to request:
> -//
> -// opts['classname']: java classname, like 'org.openlaszlo.MyClass'.
> -// opts['methodname']: name of method to invoke in server, like
> -// "CLASSNAME.METHOD".
> -// opts['oname'] unique name of server object for invoking a session or
> -// webapp object.
> -// opts['scope'] scope of object; one of 'session', 'webapp', or 'static'.
> -// opts['doreq'] if value is 1, adds http request to remote method call.
> -// opts['dores'] if value is 1, adds http response to remote method call,
> -//
> -// @param Boolean secure: if true, make secure request.
> -// @param Integer secureport: port to use for secure request. This is ignored if
> -// secure is false.
> -// @return sequence number of request.
> -//------------------------------------------------------------------------------
> -function invoke (delegate, args, opts, secure, secureport){
> -
> - if ( delegate.__proto__ != _root.LzDelegate.prototype ) {
> - _root.Debug.write("ERROR: LzDelegate is required, got:", delegate);
> - return;
> - }
> -
> - var methodname = opts['methodname'];
> - var mesg = new _root.XMLRPCMessage(methodname);
> - for (var i=0; i < args.length; i++) {
> - mesg.addParameter(_root.LzBrowser.xmlEscape(args[i]));
> - }
> -
> - var o = this.__LZgetBasicLoadParams('POST');
> - o['url'] = "java://" + opts['classname'];
> - o['lzpostbody'] = mesg.xml();
> - o['objectreturntype'] = opts['objectreturntype'];
> - o.opinfo = {};
> -
> - // Add options for remote java object
> - for (var k in opts) {
> - o[k] = opts[k];
> - o.opinfo[k] = opts[k];
> - }
> -
> - return this.request( o, delegate, secure, secureport );
> -}
> -}
> -
> -
> -// global JavaRPC service
> -var LzJavaRPCService = new LzJavaRPC();
> -
> -
> -]]>
> -</script>
> </library>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> * Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/javarpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/javarpc.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/namespace.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/namespace.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/qname.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/qname.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/rpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/rpc.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/soap.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/soap.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpc.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpc.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpcmessage.js
>
>
> Property changes on: openlaszlo/branches/legals/lps/components/rpc/library/swf/xmlrpcmessage.js
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Modified: openlaszlo/branches/legals/lps/components/rpc/library/xmlrpc.js
> ===================================================================
> --- openlaszlo/branches/legals/lps/components/rpc/library/xmlrpc.js 2007-02-28 20:20:42 UTC (rev 3977)
> +++ openlaszlo/branches/legals/lps/components/rpc/library/xmlrpc.js 2007-02-28 20:41:00 UTC (rev 3978)
> @@ -1,96 +1,14 @@
> <library>
> -<include href="xmlrpcmessage.js" />
> -<include href="rpc.js" />
> -<script when="immediate">
> -<![CDATA[
> + <switch>
> + <when runtime="dhtml">
> + <include href="dhtml/xmlrpc.js" />
> + </when>
> + <otherwise>
> + <include href="swf/xmlrpc.js" />
> + </otherwise>
> + </switch>
>
>
> -/* LZ_COPYRIGHT_BEGIN */
> -/****************************************************************************
> - * Copyright (c) 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
> - * Use is subject to license terms *
> - ****************************************************************************/
> -/* LZ_COPYRIGHT_END */
> -
> -//======================================================================
> -// DEFINE OBJECT: LzXMLRPC
> -//
> -// Implements an object to make remote java direct and XMLRPC calls.
> -//======================================================================
> -class LzXMLRPC extends LzRPC {
> -
> -//------------------------------------------------------------------------------
> -// Make remote request. Data will be the return value of the remote method
> -// call, e.g., string, integer, array, struct, etc. Errors are returned like:
> -//
> -// { status: STATUS, message: MESSAGE }
> -//
> -// where STATUS is one of 'ok' or 'error'.
> -//
> -// @param LzDelegate delegate: delegate to call when object is returned.
> -// @param String handler: can be a java classname or URL. If classname, does
> -// java direct. If it's an URL, opts is ignored.
> -// @param String methodname: name of method to invoke in server, like
> -// "CLASSNAME.METHOD".
> -// @param Object opts: options to add to request:
> -//
> -// opts['oname'] unique name of server object for invoking a session or
> -// webapp object.
> -// opts['scope'] scope of object; one of 'session', 'webapp', or 'static'.
> -// opts['doreq'] if value is 1, adds http request to remote method call.
> -// opts['dores'] if value is 1, adds http response to remote method call,
> -//
> -// @param Array args: array of argument parameters for remote function.
> -// @param Boolean secure: if true, make secure request.
> -// @param Integer secureport: port to use for secure request. This is ignored if
> -// secure is false.
> -// @return sequence number of request.
> -//------------------------------------------------------------------------------
> -function invoke (delegate, args, opts, secure, secureport) {
> -
> - if ( ! (delegate instanceof LzDelegate )) {
> - Debug.write("ERROR: LzDelegate is required, got:", delegate);
> - return;
> - }
> -
> - var service = opts['service'];
> - if (service == null) {
> - Debug.write("ERROR: service not defined");
> - return;
> - }
> -
> - var index = service.indexOf("http:");
> - if (index == -1 || index != 0) {
> - Debug.write("xmlrpc.js ERROR: only HTTP XML-RPC services supported");
> - return;
> - }
> -
> - var handler = 'xmlrpc' + service.substring(4);
> -
> - var methodname = opts['methodname'];
> - var mesg = new XMLRPCMessage(methodname);
> - for (var i=0; i < args.length; i++) {
> - mesg.addParameter(LzBrowser.xmlEscape(args[i]));
> - }
> -
> - var o = this.__LZgetBasicLoadParams('POST');
> - o['url'] = handler;
> - o['headers'] = 'Content-Type: text/xml';
> - o['lzpostbody'] = mesg.xml();
> -
> - o.opinfo = { service: service, methodname: methodname };
> -
> - return this.request( o, delegate, secure, secureport );
> -}
> -
> -}
> -
> -// global XMLRPC service
> -LzXMLRPCService = new LzXMLRPC();
> -
> -
> -]]>
> -</script>
> </library>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> * Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
--
Regards,
Max Carlson
OpenLaszlo.org
More information about the Laszlo-checkins
mailing list