Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
You're right, the session wasn't shared because each was running as a separate Application (servlet).I built the pages at different times was just testing...but now the app is coming together - time to clean house! It works now, thank you!On 3/17/06, Johan Compagner <[EMAIL PROTECTED]> wrote: w

Re: [Wicket-user] objects in session

2006-03-17 Thread Johan Compagner
why do you have 2 applications objects for youre web application?Do you have 2 wicket servlets mapped? Do you really have 2 webapps?But then you don't share session data. Because you make 2 session objects. 1 for login and 1 for Edit product application. Why are you doing that?Also better thing to

Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
I'm doing exactly that and I don't see how I could invalidating the session in any way.Let me clarify;  I have a Login page and a EditProduct page.  EditProduct will be one of many pages of which I'd like only the administrator User to access. So, the Login Application class has this override:    p

Re: [Wicket-user] objects in session

2006-03-17 Thread Johan Compagner
i have no idea what you exactly do but if you put something in the session like((MySession)getSession()).setUser(new User());and then later on get it back:((MySession)getSession()).getUser(); then it will be there. Ofcource the session shouldn't be invalidated and the browser should support cookies

Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
This still isn't working how I would have expected... So I've still got a Login page and an EditProduct page.  If I go to /login (Login page) and login...I can't then go to /edit_product (EditProduct page) - I'll be automatically redirected back to Login...so obviously the User object was not foun

Re: [Wicket-user] objects in session

2006-03-17 Thread Johan Compagner
no it means that the session will be replicated when you use clustering. So it will update itself in the httpsession.yes just clear a reference and call dirty() this will ofcourse remove the object from the session. johanOn 3/17/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: And this does what?  The

Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
And this does what?  The Javadoc just says it marks the session as dirty...does this mean it will be cleaned up automatically?On 3/17/06, Johan Compagner <[EMAIL PROTECTED]> wrote: don't forget to call dirty() method on the session object when you change a value of the session:    public void setU

Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
What about removing objects from the session?  Simply use the setter to set to null?  Will that clear it?On 3/17/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:Yep, my mistake, thanks!  It works fine.  I guess it'll take some getting used to but it's not all that bad. -vOn 3/16/06, Igor Vaynberg < [

Re: [Wicket-user] objects in session

2006-03-17 Thread Johan Compagner
don't forget to call dirty() method on the session object when you change a value of the session:    public void setUser(User user)    {        this.user = user;     dirty();    }johanOn 3/17/06, Vincent Jenks <[EMAIL PROTECTED] > wrote:Yep, my mistake, thanks!  It works fine.  I guess it'll ta

Re: [Wicket-user] objects in session

2006-03-17 Thread Vincent Jenks
Yep, my mistake, thanks!  It works fine.  I guess it'll take some getting used to but it's not all that bad.-vOn 3/16/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:UserSession us = new UserSession( EditProductApp.get());this is wrong, you dont create the session yourself, you let wicket create it fo

Re: [Wicket-user] objects in session

2006-03-16 Thread Eelco Hillenius
It is a major goal of Wicket to simplify things. But not the only/ utmost. There are a couple of good reasons for the way we implemented session: 1) Discourage direct usage of HttpSession. - If you play by the rules and use the Wicket Session, you may later decide to store the session e.g. in a

Re: [Wicket-user] objects in session

2006-03-16 Thread Igor Vaynberg
UserSession us = new UserSession(EditProductApp.get());this is wrong, you dont create the session yourself, you let wicket create it for you (thats why you return a factory)so in your page:UserSession session=(UserSession)getSession(); sometimes nice to have this wrapped in a basepage.-IgorOn 3/16/

Re: [Wicket-user] objects in session

2006-03-16 Thread Vincent Jenks
I see, well I'm not complaining but my point is; it's just not simple to use and in most other aspects...wicket is worlds easier than JSP + Servlets.  Perhaps there needs to exist a sub-implementation of WebSession that is global and easy to access & use...just for those of us who don't need to use

Re: [Wicket-user] objects in session

2006-03-16 Thread Jonathan Cone
: Thursday, March 16, 2006 5:48 PM Subject: Re: [Wicket-user] objects in session Just as an observation, this seems a bit cumbersome to simply add/access/remove objects from the HttpSession (but that's just my opinion.)It make sense, it just seems like a lot of work to tap

Re: [Wicket-user] objects in session

2006-03-16 Thread Igor Vaynberg
we do not provide that get/setObject() method because we want to encourage type safety.furthermore the session is also used to store application logic, like logic related to authentication/authorization or anything else youd like. it is not a simple Map like http session, it can be much much more.

Re: [Wicket-user] objects in session

2006-03-16 Thread Vincent Jenks
Just as an observation, this seems a bit cumbersome to simply add/access/remove objects from the HttpSession (but that's just my opinion.)It make sense, it just seems like a lot of work to tap into session values. I suppose if I had a single getter/setter that used an Object parameter I could make

Re: [Wicket-user] objects in session

2006-03-16 Thread Igor Vaynberg
yep.-IgorOn 3/16/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: MySessionObject being a class you created subclassing WebSession?On 3/16/06, Jonathan Cone <[EMAIL PROTECTED] > wrote: Hey Vincent,   What I would do is override getSessionFactory in your application class, something like this:  

Re: [Wicket-user] objects in session

2006-03-16 Thread Jonathan Cone
Yep - so then any instance variables you put in that class will be stored in the session. - Original Message - From: Vincent Jenks To: wicket-user@lists.sourceforge.net Sent: Thursday, March 16, 2006 5:26 PM Subject: Re: [Wicket-user] objects in session

Re: [Wicket-user] objects in session

2006-03-16 Thread Vincent Jenks
MySessionObject being a class you created subclassing WebSession?On 3/16/06, Jonathan Cone <[EMAIL PROTECTED] > wrote: Hey Vincent,   What I would do is override getSessionFactory in your application class, something like this:    @Override protected ISessionFactory getSessionFactory() {  r

Re: [Wicket-user] objects in session

2006-03-16 Thread Jonathan Cone
Hey Vincent,   What I would do is override getSessionFactory in your application class, something like this:    @Override protected ISessionFactory getSessionFactory() {  return new ISessionFactory() {    public Session newSession() {return new MySessionObject(YourApplicationClass.this)

Re: [Wicket-user] objects in session

2006-03-16 Thread Igor Vaynberg
create a WebSession subclass and instead fo storing it in your page stored it there instead. then you can get to it from anywhere.-IgorOn 3/16/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: If objects used in a page are stored in a session, how do I access those objects when I redirect to a new page