You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2007/09/11 23:00:07 UTC

Accessing to session scope attribute

I need to store some data on a per session basis.

What's the best approach in a wicket environment?

1. Should I create my own session factory and create a custom session
class that stores the data as an attribute?

OR

2. Go the old fashioned route and retrieve the J2?E HttpSession and
store it in that using setAttribute(name, object);   BTW how do we get
access to the J2?E session in Wicket?

OR

3. Something else I haven't thought of yet...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Accessing to session scope attribute

Posted by Carlos Pita <ca...@gmail.com>.
>From wicket.Session javadoc:
"""
Arbitrary objects can be attached to a Session by installing a session
factory on your Application class which creates custom Session
subclasses that have typesafe properties specific to the application
(see Application for details). To discourage non-typesafe access to
Session properties, no setProperty() or getProperty() method is
provided.
"""

That said, if you still want to set type unsafe properties, you can
always access the HttpSession as
((WebRequest)getRequest()).getHttpServletRequest().getSession().

Also, if you use spring to manage your application layer you may want
(I don't :)) to use a session scoped bean.

Regards,
Carlos

On 9/11/07, Chris Colman <ch...@stepaheadsoftware.com> wrote:
> I need to store some data on a per session basis.
>
> What's the best approach in a wicket environment?
>
> 1. Should I create my own session factory and create a custom session
> class that stores the data as an attribute?
>
> OR
>
> 2. Go the old fashioned route and retrieve the J2?E HttpSession and
> store it in that using setAttribute(name, object);   BTW how do we get
> access to the J2?E session in Wicket?
>
> OR
>
> 3. Something else I haven't thought of yet...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org