Author: lou
Date: 2008-03-25 11:13:33 -0700 (Tue, 25 Mar 2008)
New Revision: 8394
Modified:
openlaszlo/trunk/lps/components/rpc/sessionrpc.lzx
Log:
Change 20080325-lou-w by [EMAIL PROTECTED] on 2008-03-25 14:06:17 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add intro paragraphs and live code example from 3.4, fix links
Bugs Fixed: LPP-5655
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Tests: visual verify
Modified: openlaszlo/trunk/lps/components/rpc/sessionrpc.lzx
===================================================================
--- openlaszlo/trunk/lps/components/rpc/sessionrpc.lzx 2008-03-25 18:12:23 UTC
(rev 8393)
+++ openlaszlo/trunk/lps/components/rpc/sessionrpc.lzx 2008-03-25 18:13:33 UTC
(rev 8394)
@@ -9,24 +9,6 @@
</allow>
</security>
- <!--- A class to get an http session object and invoke its methods. Remote
- method signatures are:
-
- getAttribute(name) - returns object, array, or primitive type.
- getAttributeNames() - returns array of attribute names.
- getId() - returns remote session id
- getMaxInactiveInterval() - returns max inactive interval for session.
- invalidate() - invalidate remote session
- isNew() - returns true if the client does not yet know about the
- session or if the client chooses not to join the session.
- removeAttribute(name) - remove attribute named name; returns void.
- setAttribute(name,value) - set attribute named name with value;
returns
- void.
- setMaxInactiveInterval(interval) - set max inactive interval for
- session.
-
- See javax.servlet.http.HttpSession in the Java Servlet API
- documentation for more information. -->
<class name="sessionrpc" extends="rpc">
<!--- @keywords private -->
@@ -71,12 +53,204 @@
return ok;
</method>
-
+<doc>
+ <tag name="shortdesc"><text>SessionRPC object</text></tag>
+ <text>
+ <p>A class to get an http session object and invoke its methods. Remote
method
+ signatures are:</p>
+
+
+ <ul>
+
+ <li>
+ <dfn>getAttribute(name)</dfn>: returns object, array, or primitive
+ type.</li>
+
+ <li>
+ <dfn>getAttributeNames()</dfn>: returns array of attribute
names.</li>
+
+ <li>
+ <dfn>getId()</dfn>: returns remote session id</li>
+
+ <li>
+ <dfn>getMaxInactiveInterval()</dfn>: returns max inactive interval
for
+ session.</li>
+
+ <li>
+ <dfn>invalidate()</dfn>: invalidate remote session.</li>
+
+ <li>
+ <dfn>isNew()</dfn>: returns true if the client does not yet know
about the
+ session or if the client chooses not to join the session.</li>
+
+ <li>
+ <dfn>removeAttribute(name)</dfn>: remove attribute named name;
returns
+ void.</li>
+
+ <li>
+ <dfn>setAttribute(name,value)</dfn>: set attribute named name with
value;
+ returns void.</li>
+
+ <li>
+ <dfn>setMaxInactiveInterval(interval)</dfn>: set max inactive
interval for
+ session.</li>
+
+ </ul>
+
+
+ <p>See <a
href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html"
shape="rect">
+ javax.servlet.http.HttpSession</a> in the <a
href="http://java.sun.com/products/servlet/2.3/javadoc/" shape="rect">Java
Servlet API</a>
+ documentation for details.</p>
+ <example>
+ <canvas width="800" height="450" debug="true">
+
+ <debug x="300" y="20" width="500" height="400" />
+
+ <include href="rpc/sessionrpc.lzx" />
+
+ <dataset name="idDset" />
+
+ <sessionrpc id="session" autoload="false">
+
+ <handler name="oninit">
+ Debug.write('loading session object...')
+ this.load();
+ </handler>
+
+ <handler name="onload">
+ Debug.write('session object loaded');
+ canvas.buttons.setAttribute('visible', true);
+ </handler>
+
+ <handler name="ondata" args="data">
+ Debug.write("default ondata:", data);
+ </handler>
+
+ <handler name="onerror" args="error">
+ Debug.write("default onerror:", error);
+ </handler>
+
+ <remotecall funcname="getId" />
+
+ <remotecall name="getIdWithDset" funcname="getId"
dataobject="idDset" />
+
+ <remotecall funcname="getMaxInactiveInterval" />
+
+ <remotecall funcname="isNew" />
+
+ <remotecall funcname="setMaxInactiveInterval">
+ <param value="15" />
+ </remotecall>
+
+ <remotecall name="setmyattr" funcname="setAttribute">
+ <param value="'myattr'" />
+ <param value="'MY ATTRIBUTE'" />
+ </remotecall>
+
+ <remotecall name="setmyother" funcname="setAttribute">
+ <param value="'myother'" />
+ <param value="'MY OTHER'" />
+ </remotecall>
+
+ <remotecall name="getmyattr" funcname="getAttribute">
+ <param value="'myattr'" />
+ </remotecall>
+
+ <remotecall name="getmyother" funcname="getAttribute">
+ <param value="${'myother'}" />
+ </remotecall>
+
+ <remotecall funcname="getAttributeNames" />
+
+ <remotecall name="removemyattr" funcname="removeAttribute">
+ <param value="'myattr'" />
+ </remotecall>
+
+ <remotecall name="removemyother" funcname="removeAttribute">
+ <param value="'myother'" />
+ </remotecall>
+
+ </sessionrpc>
+
+
+ <view name="buttons" x="10" y="10" layout="spacing: 5"
visible="false">
+ <button text="getId" onclick="session.getId.invoke()" />
+ <button text="getIdWithDset"
onclick="session.getIdWithDset.invoke()" />
+ <view height="20" width="50">
+ <text datapath="idDset:/text()" width="240"
bgcolor="red"/>
+ </view>
+ <button text="getMaxInactiveInterval"
onclick="session.getMaxInactiveInterval.invoke()" />
+ <button text="isNew" onclick="session.isNew.invoke()" />
+ <button text="setMaxInactiveInterval"
onclick="session.setMaxInactiveInterval.invoke()" />
+
+ <view x="20" layout="spacing: 5">
+
+ <attribute name="myDel" value="null" type="expression" />
+
+ <handler name="oninit">
+ this.myDel = new LzDelegate(this, 'myhandler');
+ </handler>
+
+ <method name="myhandler" args="data">
+ Debug.write('myhandler:', data);
+ </method>
+
+ <button text="setmyattr"
onclick="session.setmyattr.invoke()" />
+
+ <button text="setmyother"
onclick="session.setmyother.invoke()" />
+
+ <button text="getmyattr"
onclick="session.getmyattr.invoke()" />
+
+ <button text="getmyother"
onclick="session.getmyother.invoke()" />
+
+ <button text="getmyattr (w/params)"
onclick="session.getmyattr.invoke(['myattr'])" />
+
+ <button text="getmyattr (w/params and delegate)">
+ <handler name="onclick">
+ session.getmyattr.invoke(['myattr'], parent.mydel);
+ </handler>
+ </button>
+
+ <button text="getAttributeNames"
onclick="session.getAttributeNames.invoke()" />
+
+ <button text="removemyattr"
onclick="session.removemyattr.invoke()" />
+
+ <button text="removemyother"
onclick="session.removemyother.invoke()" />
+
+ </view>
+ </view>
+ </canvas>
+ </example>
+ <b>See Also:</b>
+ <br />
+ <ul>
+ <li>
+ <a href="../reference/rpc.html"><code
class="classname">rpc</code></a>
+ </li>
+ <li>
+ <a href="../reference/javarpc.html"><code
class="classname">javarpc</code></a>
+ </li>
+ <li>
+ <a href="../reference/webapprpc.html"><code
class="classname">webapprpc</code></a>
+ </li>
+ <li>
+ <a href="../reference/remotecall.html"><code
class="classname">remotecall</code></a>
+ </li>
+ <li>
+ <a href="../developers/rpc.html" target="laszlo-dguide"
shape="rect">Developer's Guide: RPC chapter</a>
+ </li>
+ <li>
+ <a href="../developers/rpc-javarpc.html"
target="laszlo-dguide" shape="rect">Developer's Guide: JavaRPC chapter</a>
+ </li>
+ </ul>
+
+ </text>
+</doc>
</class>
</library>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@ -->
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins