You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Grefe, Jochen" <jo...@IngenieurTeam2.com> on 2003/08/16 12:39:23 UTC

Best way for (nearly) sessionless apps

What is the best way to avoid 
reentering the former state after
a session timeout?

Don't instantiate the Visit object and don't mark
properties persistent (anything else left) to avoid
the creation of a session is one way, I think.

Or to persistent store the session state into a database
and recreate the former state after a new logon.

The first solution (if possible?) is clear, but limits
the possibilities of Tapestry. How, if ever possible,
to implement the second solution?

Thanks
Jochen

Re: Best way for (nearly) sessionless apps

Posted by John Meredith <ps...@t-online.de>.
Hi,

> What is the best way to avoid 
> reentering the former state after
> a session timeout?
> 
> Don't instantiate the Visit object and don't mark
> properties persistent (anything else left) to avoid
> the creation of a session is one way, I think.
> 
> Or to persistent store the session state into a database
> and recreate the former state after a new logon.
> 
> The first solution (if possible?) is clear, but limits
> the possibilities of Tapestry. How, if ever possible,
> to implement the second solution?

I guess it depends on what information you want to persist, and how long
you want to persist it.

If it's properties specific to the client/user involved i.e.
locale/language or perhaps the client's role within your application,
you would want to add these to your data model, which would ultimately
be persisted to your database, and be read when the user logs in again.

In the Tapestry examples (Vlib or workbench - can't remember which), an
email address is persisted in a cookie - so that upon re-authentication,
the email address is automatically placed in the email field.

If you want to persist the whole session (all persistent data) forever
you have the option of setting the session timeout in your web.xml or
application configuration.

As far as I'm aware (someone correct me if I'm wrong), most servlet
containers have options allowing you to store session data where you
want. Resin, for example, allows you to specify file-store (instead of
the default memory) in your web.xml config:

<session-config>
  <session-timeout>120</session-timeout>
  <file-store>WEB-INF/sessions</file-store>
</session-config>

[This may be be part of the servlet spec - I'm not sure]

You can also specify a db as well - check your servlet containers
documentation to find out the specifics.

Hope this helps.

  - John

-- 
John Meredith <ps...@t-online.de>

RE: Best way for (nearly) sessionless apps

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.

> -----Original Message-----
> From: Grefe, Jochen [mailto:jochen@IngenieurTeam2.com] 
> Sent: Saturday, August 16, 2003 6:39 AM
> To: 'tapestry-user@jakarta.apache.org'
> Subject: Best way for (nearly) sessionless apps
> 
> 
> What is the best way to avoid 
> reentering the former state after
> a session timeout?
> 
> Don't instantiate the Visit object and don't mark
> properties persistent (anything else left) to avoid
> the creation of a session is one way, I think.
> 
> Or to persistent store the session state into a database
> and recreate the former state after a new logon.

This is a valid option, but requires that you manage state with your own cookie (or, perhaps, your
own URL encoded scheme).  The page recorders, responsible for persisting page properties, are very
much pluggable (by overriding methods on AbstractEngine). The hooks are there for you to make it
work, but it would be some amount of work.


> 
> The first solution (if possible?) is clear, but limits
> the possibilities of Tapestry. How, if ever possible,
> to implement the second solution?



--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry