You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark Heimann <mh...@steroid-interactive.com> on 2010/07/21 11:35:29 UTC
Best Approach to retrieve a session ID in Tapestry 5.1
Hi everyone,
I was wondering what would be the best approach to retrieve a session ID using Tapestry 5.1. My understanding is that the wrappers Tapestry creates around the HttpSession object does not expose a getId() method that would return a string representation of the session to me.
I have tried injecting the HttpServletRequest into my page class and retrieving the un-wrapped version of the session object from there in order to be able to call said getId() method. Is Tapestry going to notice that I mess around with the un-wrapped request and session objects or would you expect it to break at some point?
The reason why I need to access the session ID is that I need to supply it as a parameter to a Flash object on the page and as far as I know you can't rely on session cookies when it comes to Flash making HTTP calls.
Thanks a lot in advance!
Cheers,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Best Approach to retrieve a session ID in Tapestry 5.1
Posted by Christian Riedel <cr...@googlemail.com>.
I think your approach is ok. The reason for the wrapper objects are (I think) to provide some additional functionality such as "Session#isInvalidated" and some clustering optimizations.
If you call Session#invalidate the session object remembers it so that you can ask isInvalidated later, but that seems to be the only thing the wrapper keeps track of.
Hope that was helpful :)
Best
Christian
Am 21.07.2010 um 11:35 schrieb Mark Heimann:
> Hi everyone,
>
> I was wondering what would be the best approach to retrieve a session ID using Tapestry 5.1. My understanding is that the wrappers Tapestry creates around the HttpSession object does not expose a getId() method that would return a string representation of the session to me.
>
> I have tried injecting the HttpServletRequest into my page class and retrieving the un-wrapped version of the session object from there in order to be able to call said getId() method. Is Tapestry going to notice that I mess around with the un-wrapped request and session objects or would you expect it to break at some point?
>
> The reason why I need to access the session ID is that I need to supply it as a parameter to a Flash object on the page and as far as I know you can't rely on session cookies when it comes to Flash making HTTP calls.
>
> Thanks a lot in advance!
>
> Cheers,
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org