My solution to this involves keeping track of my own session.
I have an object called SessionTracker, which has a simple @SetupRender
method and a @Persist field. when I check for a valid session,
I check is the @Persist variable is still available.
With this method, no custom callback is necessary to check whether the
session
is new or not.
Taha Hafeez wrote:
>
> Hi Geoff
>
> I am thinking at the request filter level using a combination of
> HttpSession.isNew() and some callback to check with the application if
> the session is new (like login details etc)
>
> session = request.getSession(false);
>
> if(session ==null || (session.isNew() && myCallback.isNew(session))){
> //it has expired
> }else {
> //it has not expired
> }
>
> myCallback.isNew(session) can check user login details.
>
> On Wed, Sep 21, 2011 at 4:54 AM, Geoff Callender
> <[email protected]> wrote:
>> Hi Taha,
>>
>> Let's say there was a @SessionRequired annotation to put on methods. When
>> session expires it redirects to a "session expired" page. But how would
>> it determine whether session has expired vs. first time in? It would have
>> to register sessions centrally somehow. More than that, it would have to
>> register current page(s) within session, and remove them as you leave the
>> page. Is that what you have in mind?
>>
>> On 21/09/2011, at 12:05 AM, Taha Hafeez wrote:
>>
>>> Hi Lenny
>>>
>>> I am using ajax grid in many of my applications. As I am using 5.2.6
>>> on some of the projects, I use my tapestry.js hack for it.
>>>
>>> The inability of grid to provide zone parameter (as others components
>>> do) instead of inplace is a limitation but I think this can be sorted
>>> out with the new ajax support.(I have not tried it yet but I think it
>>> can be done).
>>>
>>> Regarding session expiry, I think a simple redirect to a session
>>> expired page can be useful both for ajax and non-ajax situations.
>>>
>>>
>>> On Tue, Sep 20, 2011 at 1:24 PM, Lenny Primak
>>> <[email protected]> wrote:
>>>> Hi guys,
>>>>
>>>> I just want to share my thoughts with you regarding my experience
>>>> building pretty simple infrastructure.
>>>> Don't get me wrong, I love tapestry but I think there's definitely room
>>>> for improvement here.
>>>>
>>>> My goal was simple: Develop a page that has an Ajax Grid that is
>>>> backed by a database table.
>>>>
>>>> To get this into somewhat decent shape it took about one man-month,
>>>> which I think could be improved.
>>>> After a minor hiccup with JPA and problems with multiple database
>>>> support, I got the basic page up and
>>>> running rather quickly. (kudos)
>>>> Afterwards, I started noticing minor issues that took major time to
>>>> fix.
>>>> What I wound up with is a hodgepodge of hacks/workarounds to get
>>>> everything just right.
>>>> Lots of JavaScript and event handling code.
>>>> I believe that this stuff should work out of the box.
>>>>
>>>> It all boiled down to one major issue:
>>>> Tapestry does not know how to deal with Ajax and expiring sessions.
>>>> I would either get an error dialog, an exception, NULL data, or all of
>>>> the above when:
>>>> - clicking on the Grid pager
>>>> - clicking on a button that would update the grid (Ajax)
>>>>
>>>> Basically there are about 10 corner cases that deal with expired
>>>> sessions that
>>>> were very hard to track down.
>>>>
>>>> All my hacks/workarounds do one thing: When Ajax call is made,
>>>> and the session is invalid (or new w/o SetupRender being called)
>>>> I redirect to the same page, causing a reload or relogin if security
>>>> credentials also expired.
>>>>
>>>> I will try to post as much of this as I can as soon as I can on the
>>>> wiki or github or both,
>>>> but I think this functionality should work out-of-the box.
>>>>
>>>> Thanks for the great product, and will be going into production soon.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Regards
>>>
>>> Taha Hafeez Siddiqi (tawus)
>>> http://tawus.wordpress.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
>
> --
> Regards
>
> Taha Hafeez Siddiqi (tawus)
> http://tawus.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Thoughts-Should-Ajax-Grid-be-that-hard-tp4821689p4826903.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]