Yes, it's a Bug.  I think.  Or a very poor, unwanted, and undocumented feature.

As Casey O'Brien and I have been migrating Apps from 3.12 to 4.12, we came across a 
problem
of Session Objects disappearing between pages.  After setting a bunch of Session 
Objects, they
were valid anytime during the current web event, but during the next web event, some 
(not all) of
the Session Objects would no longer be there.  After a thorough, methodical reduction 
of the
possibilities, we determined that the User Session Objects were not being removed by 
our code.

So what were happening to them?  Look at the following two lines of code:

CSpider.putUserSessionObject("OBJ_1", new CSpString("OBJ"));
CSpider.putUserSessionObject("OBJ_2", CSpider.getUserSessionObject("OBJ_1"));

The first puts the CSpString "OBJ" as a session object.  The second line puts the 
exact same
object into a different session variable.  Guess what?  The first session object, 
"OBJ_1",
disappears after the Web event.  You can use it anywhere in your code after you set 
it, but the
next time the user requests a page, that User Session Object will no longer exist.  
"OBJ_2" will
continue to exist, but not "OBJ_1".

So, it looks like there is a problem in the persistance of Session Objects.  Or, it's 
an undocumented
feature that you can not have more than one Session Object refer to the same java 
object.

Here is the work around:

CSpider.putUserSessionObject("OBJ_1", new CSpString("OBJ"));
CSpider.putUserSessionObject("OBJ_2", new 
CSpString(CSpider.getUserSessionObject("OBJ_1").stringValue());

Now, a new CSpString object is created, and both Session Objects persist.

If you wish to see the problem up close and personal, I have included an URL below to 
a sample
project which clearly demonstrates the bug.  Be sure to look at the code both within 
the Project's
Java file as well as the Page's Java file:

http://home.context.com/jfowler/NDProjects/TestSessionLoss.zip

john...

PS.  Thanks to Casey O'Brien for tipping me off to the bug.



_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to