----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Sorry, but dont't have time to dig into your actual problem - but
may I suggest another approach which I have used for saving
user state?

We created a special sessionobject which we serialize to serverdisk
upon creation/save. It is then accessible to all servlets
and we have a thread deleting the "disk sessions" after a certain timeout.

This is super - no cookies and unlimited space for user info without
having to set cookies or cramming lots of info into one cookie.

All we do in a servlet is:

(pseudo code)
{
get session id
sessionobj s = new sessionobj(sessionid)  // If the "disk session" doesn't
exist - create one if this servlet wants to add info to it
// Now 's' contains all user data  - if any
use the session data
set session data
 If we have set the data and want to save changes {
   s.save(sessionid)
 } else do absolutely nothing with the session
}

Also, our sessionobject contains only a hashtable with attributes which are
easily interchangable
OR you can use regular fields and reflect to find out their names/values so
that the session object
is totally dynamic without.

This also allows for EXACT and remote monitoring of user actions.

This of course, requires knowledge of serialisation of objects and reflect.

I would suggest taking this thread to a servlet/java list, maybe at sun ...
or hire us ;-)

HTH
//OLAS



Chris Cheshire wrote:

> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
>
> Hi,
>
> I am having ongoing problems relating to servlets and user information.
>
> I am running Apache 1.3.12, with Jserv 1.1.2, with JDK 1.2.2 on
> Redhat linux 6.2.
>
> I have a servlet which takes a user's information and verifies it in the
> database and when correct it sets a cookie on the user's computer with
> the
> person's associated customerid with our company. This cookie is
> then checked for when other applications on our site need customer
> information.
> The value from this cookie is used to access the database again in
> other servlets to retrieve further information from the web site.
> When passing information around in a servlet while it is performing its
> job for a user, I am using an instance of a specific helper class for
> that
> servlet and passing it about, rather than setting class wide variables
> for
> the servlet. We are getting member complaints that sometimes they are
> not
> viewing their own information. This means that for some reason the
> servlet
> is not reading their cookie but someone else's cookie. Either that or
> instances
> of the helper class that are being instantiated inside a service(),
> doGet() or
> doPost() are being confused with other instances when the servlet is
> being hit
> from multiple users at once.
>
> I used to have some of the common information from the database stored
> in sessions
> but the problem was even worse, because the session tracking was done by
> cookies
> and the wrong cookie would be retrieved somehow and then the wrong
> information would
> be retrieved from the session. Or, again it might be the instances of
> the helper
> class getting confused.
>
> Can someone shed some light on this please?
>
> Thanks
>
> Chris
>
> (PS I have even upgraded versions of the JDK while this has been
> happening, to no
> avail).
>
> --
> Chris Cheshire
> Manager of Software Development
> bigredwire.com
> Phone : +1 805 560 6666 (w)
>         +1 805 559 9166 (m)
> Fax :   +1 805 560 8901
> Email : [EMAIL PROTECTED]
>
>    Real Programmers don't draw flowcharts.
>    Flowcharts are the illiterate's form of
>    documentation. Cavemen drew flowcharts;
>    look at how much good it did for them
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search Archives:
> <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to