Re: [Wicket-user] Custom session not working...
On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > > Sorry Matej, I opened the bug per Eelco's request before receiving your two > responses. > > I will close the issue, since it sounds like this has been discussed before, > and there are technical reasons for it staying as is. I guess this is just > a confirmation that it not intuitive to the uninitiated user, and might be > something to keep in mind for future change. In any case, we have known > workaround, so no big deal. We need to at least look at how multiple calls to #bind go though. I think it currently just bluntly keep re-registering. Probably not a big deal, but not right either. Eelco - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
Sorry Matej, I opened the bug per Eelco's request before receiving your two responses. I will close the issue, since it sounds like this has been discussed before, and there are technical reasons for it staying as is. I guess this is just a confirmation that it not intuitive to the uninitiated user, and might be something to keep in mind for future change. In any case, we have known workaround, so no big deal. Best regards, Spencer Matej Knopp-2 wrote: > > On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > >> >> Couple of follow up questions/comments that anyone can field: >> 1) I understand why you would want a stateless application, however I >> don't >> understand why you would ever want your session to be regenerated on each >> request if during the request you specifically set a session value. It >> seems like once you set a session value, the session should become bound. >> Is there a logical reason this isn't the case, or is it just a >> technological/implementation reason? I'm just trying to understand this >> better. > It's because wicket uses the session object internally, and it can't > function without having at least a temporary session. While I > understand this is not the most intuitive solution for users, changing > this behavior would require a massive change to wicket, something > which we can't do now due to the 1.3 release. > > If you have changed your session state you might want to call the > bind() method on session explicitly. > > -Matej > > -- View this message in context: http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11771136 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
> You need to call session.bind(). > > We've been discussing this many times. It's no good to make > session.dirty() bind the session, because it's called internally even > on sessions that should not be bound. On 7/24/07, Matej Knopp <[EMAIL PROTECTED]> wrote: > You need to call session.bind(). > > We've been discussing this many times. It's no good to make > session.dirty() bind the session, because it's called internally even > on sessions that should not be bound. You are right. But we do have a problem here. Maybe we should revisit this code and specify what the dirty bit actually should mean. If even we devs can't agree on it, what can we expect from our users? Originally, the idea behind dirty was to be able to detect when we needed to flush changes to the session (i.e. set the session as an attribute on the http session) so that a cluster could be notified. When this bit was introduced (pre 1.1 I believe), Wicket didn't have a stateless mode, so that wasn't a consideration back then. The code now: if (dirty) { this.dirty = false; setAttribute(SESSION_ATTRIBUTE_NAME, this); } seems to be exactly that. But this doesn't make sense when the session is not bound anyway! Also, I know there are quite a few methods calling Session#dirty, but I wonder if they all do it for the good reasons. The problem with explicitly calling bind is that the session store's bind implementation is called as well. Maybe that implementation should do some more checking whether the session was already bound or not. Eelco - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > > Thanks Eelco, that did the trick. > > Couple of follow up questions/comments that anyone can field: > 1) I understand why you would want a stateless application, however I don't > understand why you would ever want your session to be regenerated on each > request if during the request you specifically set a session value. It > seems like once you set a session value, the session should become bound. > Is there a logical reason this isn't the case, or is it just a > technological/implementation reason? I'm just trying to understand this > better. It's because wicket uses the session object internally, and it can't function without having at least a temporary session. While I understand this is not the most intuitive solution for users, changing this behavior would require a massive change to wicket, something which we can't do now due to the 1.3 release. If you have changed your session state you might want to call the bind() method on session explicitly. -Matej - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
You need to call session.bind(). We've been discussing this many times. It's no good to make session.dirty() bind the session, because it's called internally even on sessions that should not be bound. -Matej On 7/24/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > > > > Alright, so from what you guys have said, I think there is a bug. > > Darn! :) Could you open an issue please? I'll look into it asap. > > Eelco > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > > Alright, so from what you guys have said, I think there is a bug. Darn! :) Could you open an issue please? I'll look into it asap. Eelco - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
Alright, so from what you guys have said, I think there is a bug. I had not called session.dirty() before, but since that sounded reasonable, I took out the call to session.bind() and updated my property setter so that after it set the value, it called dirty. In this simple case: public Integer getX() { return this.x; } public void setX(Integer x) { this.x = x; this.dirty(); } In an otherwise stateless page, I have the following code: public Index(final PageParameters parameters) { ... MySession s = (MySession) MySession.get(); s.setX( s.getX()+1 ); add(new Label("xlabel", new Model(s.getX(; ... } The expectation is that the value will increment with each refresh. In reality, a new session gets created for each request, and the value remains the same. So I think that dirty() is not working when there is no state already established? When I add the session.bind() in the application's newSession() method, everything works as expected. Hope this is helpful. Spencer igor.vaynberg wrote: > > On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: >> >> >> Thanks Eelco, that did the trick. >> >> Couple of follow up questions/comments that anyone can field: >> 1) I understand why you would want a stateless application, however I >> don't >> understand why you would ever want your session to be regenerated on each >> request if during the request you specifically set a session value. It >> seems like once you set a session value, the session should become bound. >> Is there a logical reason this isn't the case, or is it just a >> technological/implementation reason? I'm just trying to understand this >> better. > > > after you set the value on the session did you call session.dirty() to let > wicket know you have done that? i think dirty() will bind the session as > well. > > -igor > > > > > 2) The location quoted for the live examples >> (http://wicketstuff.org/wicket13/) is the one I was looking at, however >> for >> the specific example "stateless", it is not possible to view the source >> code >> and/or page files "live". Not sure how the site is maintained, but >> perhaps >> a download link could be added on the examples page to the build that the >> live examples demonstrate, by default. I've got the files now however, >> so >> thanks again! >> >> Best regards, >> >> Spencer >> >> >> >> Eelco Hillenius wrote: >> > >> >> I have a custom session class that inherits from WebSession. I have >> >> overridden the newSession method in my Application class. The session >> is >> >> getting used during the request, because I initialize some of its >> values >> >> in >> >> its constructor, and they show up when I attach a label to them in a >> >> page. >> >> A new session gets created with every request, however, which >> obviously >> >> is >> >> not the desired behavior. For instance, I have an Integer, and I >> >> initialize >> >> it to 1 in the constructor, and increment it before each page >> display. I >> >> always get back a 2 on the page. >> > >> > It sounds like your page is stateless, and the session instances are >> > temporary. As long as a session is not 'bound', you'll get a separate >> > instance per request and Wicket won't hold on to heap memory. You can >> > force the creation of a session by calling Session#bind, which I think >> > you should be able to call from your constructor as well. >> > >> >> Related to this, can someone provide me a download link to the 1.3 >> >> examples? >> >> The live examples page does not allow you to view the source for the >> >> stateless example, which seems like it may have some relevant code in >> it, >> >> and I cannot find a download link for the 1.3 examples. The >> 1.2examples >> >> do >> >> not have that particular example, from what I can tell. >> > >> > Use http://wicketstuff.org/wicket13/ to look at the examples. The >> > wicket-examples site is stale. >> > >> > As for downloading the examples for 1.3.0, at this time you can best >> > get them from SVN directly, or download them from our maven repo at >> > >> http://wicketstuff.org/maven/repository/org/apache/wicket/wicket-examples/1.3.0-SNAPSHOT/ >> > >> > Eelco >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11761829 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> ___ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > - > This SF.n
Re: [Wicket-user] Custom session not working...
> Couple of follow up questions/comments that anyone can field: > 1) I understand why you would want a stateless application, however I don't > understand why you would ever want your session to be regenerated on each > request if during the request you specifically set a session value. It > seems like once you set a session value, the session should become bound. > Is there a logical reason this isn't the case, or is it just a > technological/implementation reason? I'm just trying to understand this > better. Like Igor said, calling dirty when you set a value should do the trick. If it doesn't it's a bug :) > 2) The location quoted for the live examples > (http://wicketstuff.org/wicket13/) is the one I was looking at, however for > the specific example "stateless", it is not possible to view the source code > and/or page files "live". Not sure how the site is maintained, but perhaps > a download link could be added on the examples page to the build that the > live examples demonstrate, by default. I've got the files now however, so > thanks again! Ah, ok. That example doesn't use the header all the other examples use because that header would make it statefull :) Could probably be fixed, but atm it's a bit too much trouble. Cheers, Eelco - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
On 7/24/07, spencer.c <[EMAIL PROTECTED]> wrote: > > > Thanks Eelco, that did the trick. > > Couple of follow up questions/comments that anyone can field: > 1) I understand why you would want a stateless application, however I > don't > understand why you would ever want your session to be regenerated on each > request if during the request you specifically set a session value. It > seems like once you set a session value, the session should become bound. > Is there a logical reason this isn't the case, or is it just a > technological/implementation reason? I'm just trying to understand this > better. after you set the value on the session did you call session.dirty() to let wicket know you have done that? i think dirty() will bind the session as well. -igor 2) The location quoted for the live examples > (http://wicketstuff.org/wicket13/) is the one I was looking at, however > for > the specific example "stateless", it is not possible to view the source > code > and/or page files "live". Not sure how the site is maintained, but > perhaps > a download link could be added on the examples page to the build that the > live examples demonstrate, by default. I've got the files now however, so > thanks again! > > Best regards, > > Spencer > > > > Eelco Hillenius wrote: > > > >> I have a custom session class that inherits from WebSession. I have > >> overridden the newSession method in my Application class. The session > is > >> getting used during the request, because I initialize some of its > values > >> in > >> its constructor, and they show up when I attach a label to them in a > >> page. > >> A new session gets created with every request, however, which obviously > >> is > >> not the desired behavior. For instance, I have an Integer, and I > >> initialize > >> it to 1 in the constructor, and increment it before each page > display. I > >> always get back a 2 on the page. > > > > It sounds like your page is stateless, and the session instances are > > temporary. As long as a session is not 'bound', you'll get a separate > > instance per request and Wicket won't hold on to heap memory. You can > > force the creation of a session by calling Session#bind, which I think > > you should be able to call from your constructor as well. > > > >> Related to this, can someone provide me a download link to the 1.3 > >> examples? > >> The live examples page does not allow you to view the source for the > >> stateless example, which seems like it may have some relevant code in > it, > >> and I cannot find a download link for the 1.3 examples. The 1.2examples > >> do > >> not have that particular example, from what I can tell. > > > > Use http://wicketstuff.org/wicket13/ to look at the examples. The > > wicket-examples site is stale. > > > > As for downloading the examples for 1.3.0, at this time you can best > > get them from SVN directly, or download them from our maven repo at > > > http://wicketstuff.org/maven/repository/org/apache/wicket/wicket-examples/1.3.0-SNAPSHOT/ > > > > Eelco > > > > > > -- > View this message in context: > http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11761829 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
Thanks Eelco, that did the trick. Couple of follow up questions/comments that anyone can field: 1) I understand why you would want a stateless application, however I don't understand why you would ever want your session to be regenerated on each request if during the request you specifically set a session value. It seems like once you set a session value, the session should become bound. Is there a logical reason this isn't the case, or is it just a technological/implementation reason? I'm just trying to understand this better. 2) The location quoted for the live examples (http://wicketstuff.org/wicket13/) is the one I was looking at, however for the specific example "stateless", it is not possible to view the source code and/or page files "live". Not sure how the site is maintained, but perhaps a download link could be added on the examples page to the build that the live examples demonstrate, by default. I've got the files now however, so thanks again! Best regards, Spencer Eelco Hillenius wrote: > >> I have a custom session class that inherits from WebSession. I have >> overridden the newSession method in my Application class. The session is >> getting used during the request, because I initialize some of its values >> in >> its constructor, and they show up when I attach a label to them in a >> page. >> A new session gets created with every request, however, which obviously >> is >> not the desired behavior. For instance, I have an Integer, and I >> initialize >> it to 1 in the constructor, and increment it before each page display. I >> always get back a 2 on the page. > > It sounds like your page is stateless, and the session instances are > temporary. As long as a session is not 'bound', you'll get a separate > instance per request and Wicket won't hold on to heap memory. You can > force the creation of a session by calling Session#bind, which I think > you should be able to call from your constructor as well. > >> Related to this, can someone provide me a download link to the 1.3 >> examples? >> The live examples page does not allow you to view the source for the >> stateless example, which seems like it may have some relevant code in it, >> and I cannot find a download link for the 1.3 examples. The 1.2 examples >> do >> not have that particular example, from what I can tell. > > Use http://wicketstuff.org/wicket13/ to look at the examples. The > wicket-examples site is stale. > > As for downloading the examples for 1.3.0, at this time you can best > get them from SVN directly, or download them from our maven repo at > http://wicketstuff.org/maven/repository/org/apache/wicket/wicket-examples/1.3.0-SNAPSHOT/ > > Eelco > > -- View this message in context: http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11761829 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Custom session not working...
> I have a custom session class that inherits from WebSession. I have > overridden the newSession method in my Application class. The session is > getting used during the request, because I initialize some of its values in > its constructor, and they show up when I attach a label to them in a page. > A new session gets created with every request, however, which obviously is > not the desired behavior. For instance, I have an Integer, and I initialize > it to 1 in the constructor, and increment it before each page display. I > always get back a 2 on the page. It sounds like your page is stateless, and the session instances are temporary. As long as a session is not 'bound', you'll get a separate instance per request and Wicket won't hold on to heap memory. You can force the creation of a session by calling Session#bind, which I think you should be able to call from your constructor as well. > Related to this, can someone provide me a download link to the 1.3 examples? > The live examples page does not allow you to view the source for the > stateless example, which seems like it may have some relevant code in it, > and I cannot find a download link for the 1.3 examples. The 1.2 examples do > not have that particular example, from what I can tell. Use http://wicketstuff.org/wicket13/ to look at the examples. The wicket-examples site is stale. As for downloading the examples for 1.3.0, at this time you can best get them from SVN directly, or download them from our maven repo at http://wicketstuff.org/maven/repository/org/apache/wicket/wicket-examples/1.3.0-SNAPSHOT/ Eelco - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Custom session not working...
I have a custom session class that inherits from WebSession. I have overridden the newSession method in my Application class. The session is getting used during the request, because I initialize some of its values in its constructor, and they show up when I attach a label to them in a page. A new session gets created with every request, however, which obviously is not the desired behavior. For instance, I have an Integer, and I initialize it to 1 in the constructor, and increment it before each page display. I always get back a 2 on the page. What else do I need to do to get the custom session working under 1.3? Related to this, can someone provide me a download link to the 1.3 examples? The live examples page does not allow you to view the source for the stateless example, which seems like it may have some relevant code in it, and I cannot find a download link for the 1.3 examples. The 1.2 examples do not have that particular example, from what I can tell. Thanks for any pointers. -- View this message in context: http://www.nabble.com/Custom-session-not-working...-tf4132685.html#a11753550 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user