FW: FW: [Laszlo-dev] sessionrpc with java bean object in session

dzafer dzafer at skynet.be
Tue Jun 28 13:12:39 PDT 2005


Please any help will be appreciated.
Stopped in my Laszlo application...on those two issues:
1) Session timeout problem
2) Managing sessions bean

See below problems descriptions

Many thanks,

Best regards,
Dzafer


-----Original Message-----
From: dzafer [mailto:dzafer at skynet.be] 
Sent: Monday, June 27, 2005 1:30 PM
To: 'pkang at laszlosystems.com'
Subject: FW2: [Laszlo-dev] sessionrpc with java bean object in session



Pablo,

(Sorry I forgot in my previous reply) I still notify this problem regarding
the session

<javarpc name="jrpcUtil" classname="be.dzafer.handlers.Util_HDLR"
		scope="session" autoload="true" loadoption="loadcreate"
		objectreturntype="javabean">


After the timeout session, I receive this message error: "could not find
session instance jrpcUtil"
So the loadoption="loadcreate" doesn't create a new javarpc ?

Is there a way to recreate when session lost?
Is there a way to retrieve an error code instead of a error message to know
what kind of error has occurred?

Many thanks
Dzafer




-----Original Message-----
From: dzafer [mailto:dzafer at skynet.be] 
Sent: Monday, June 27, 2005 10:38 AM
To: 'pkang at laszlosystems.com'
Subject: FW: [Laszlo-dev] sessionrpc with java bean object in session


Hi Pablo,

First, thank you for your help!
So here is the result of idDset.childNodes [0]:

----- Debugger -----------------------------------------------------------
ddset.childNodes[0]
 <LzDataElement#1| <class>be.dzafer.models.Util_MOD</class>>
 <LzDataElement#1| <class>be.dzafer.models.Util_MOD</class>> {
  attributes: null
  childNodes: <array(1)#5| [be.dzafer.models.Util_MOD]>
  nodeName: "class"
  ownerDocument: <LzDataset#4| "idDset">
  parentNode: <LzDataset#4| "idDset">
}
 <LzDataElement#1| <class>be.dzafer.models.Util_MOD</class>>


----- Click on <array(1)#5| [be.dzafer.models.Util_MOD]> -----------------
<LzDataElement#1| <class>be.dzafer.models.Util_MOD</class>>
 <array(1)#5| [be.dzafer.models.Util_MOD]> {
  0: <LzDataText(0)#6| be.dzafer.models.Util_MOD>
}
 <array(1)#5| [be.dzafer.models.Util_MOD]>
--------------------------------------------------------------------------

So there is no data, the only data is a String: "be.dzafer.models.Util_MOD",
the class name in String type that he found in session!

What I am sure, it's that there are some data into my Java Bean in session.



So what I want to do:

1) Create a bean and put it in session (for example: a javabean that
contains all information about the logged user. Another example: keep in
session a list of all connected user)

2) Retrieve the bean into my Laszlo page for displaying information and also
modifying information and put it back into session

So, in one word sharing/modifying information between java
Servlets/javabeans and the lzx pages. 


What have try:

1) Sessionrpc: without success with JavaBeans! Works fine with "String"
types.

2) Javarpc : 

	A)In a lzx page, the javarpc will instantiated my javabean
"Util_HDLR"

	<javarpc name="jrpcUtil" classname="be.dzafer.handlers.Util_HDLR"
		scope="session" autoload="true" loadoption="loadcreate"
		objectreturntype="javabean">
		...


	B) In the Java Bean I do this :

		public boolean login(String login, String password,
HttpServletRequest req) {

			boolean logged = false;

			Util_MOD util_MOD = util_FAC.getUser(login,
passenc);

			if (util_MOD != null) {
	
req.getSession().setAttribute("attutil",util_MOD);
			} else {
			  ... error ...
			}
			...
				
	C) In another lzx page I do this to retrieve the info:

		<javarpc name="jrpcAttutil" attributename="attutil"
        		classname="be.dzafer.models.Util_MOD"
			scope="session" autoload="false"
loadoption="loadonly"
			objectreturntype="javabean">
		
			<method event="onerror" args="err">
				debug.write("errors: "+ err);
			</method>
		
			<method event="onload">
   		    		debug.write("onload ...");
				jrpcAttutil.rcutillogin.invoke();
			</method>
		
		
			<remotecall name="rcutillogin"
funcname="getUtil_s_login">
		
				<method event="ondata" args="bean">
					Debug.write("rcutillogin ondata:",
data);
				</method>
			</remotecall>
		</javarpc>
		

		...

		<button text="getBean"
					onclick="jrpcAttutil.load();" />


	D) error message in debugger : errors: couldn't find session
instance attutil




So, I really have trouble to share objects between java and Laszlo.
It's really critical for my project to be able to do that.
 
Is there two different sessions, one for the flash client and one for my
servlets ?

Thanks in advance for your help.

Best regards,
Dzafer




============================================================================
============================================================================


-----Original Message-----
From: Pablo Kang [mailto:pkang at laszlosystems.com] 
Sent: Friday, June 24, 2005 8:22 PM
To: dzafer
Cc: laszlo-dev at openlaszlo.org
Subject: Re: [Laszlo-dev] sessionrpc with java bean object in session

Is idDset empty after ondata? In the debugger, can you type 
idDset.childNodes[0] and tell me what you see?

pablo

dzafer wrote:

> Hi all,
>
> Try to use "sessionrpc" to retrieve a java bean object in session.
>
> ---------------------------------------------
> java:
>
> class: be.dzafer.models.Util_MOD
>
> .
> req.getSession ().setAttribute ("attUtil", util_MOD);
> ---------------------------------------------
>
>
> ---------------------------------------------
> Lzx:
>
> <dataset name="idDset" />
>
> <sessionrpc id="sessmenu" autoload="true">
>
> <remotecall name="getAttUtil" funcname="getAttribute" 
> dataobject="idDset" >
> <param value="'attUtil'" />
>
> <method event="ondata" args="data">
> Debug.write("default ondata:", data);
> </method>
>
> </remotecall>
>
> </sessionrpc>
> ---------------------------------------------
>
> ---------------------------------------------
> Result:
>
> default ondata: <object#0| {class: be.dzafer.models.Util_MOD}>
> ---------------------------------------------
>
>
> How can I manipulate this java object to retrieve object attributes?
>
> <text datapath="idDset:/item/name/text()" />
> <text datapath="idDset:/item" />
> <text datapath="idDset:/item [1]/name/text ()" />
> Doesn't display any results.
>
> Have try to use a text object instead of a java bean object, it work's 
> fine!
>
>
>
> Help!!! Thanks
>
> Best regard's
> Dzafer
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Laszlo-dev mailing list
>Laszlo-dev at openlaszlo.org
>http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>  
>


-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.10/25 - Release Date: 6/21/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.1/28 - Release Date: 6/24/2005
 





More information about the Laszlo-dev mailing list