Automatic redirection to Expiry Page once the session timeout is reached - Possible options

View: New views
5 Messages — Rating Filter:   Alert me  

Automatic redirection to Expiry Page once the session timeout is reached - Possible options

by mfs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Guys,

I wanted to add this feature in my application, where once the session-timeout period is reached, the user is automatically redirected to the session-expiry page, like the way you might have seen in various banking sites.

In order to achieve the above the first component which came to my mind was AbstractAjaxTimerBehavior, on which i set the to event-invocation-time to => "session-timeout_period + 1 mill-sec (or 1 sec)", where when the ajax-event is invoked (once the timeout is reached), the wicket framework would automatically redirect the user to the session-expiry page.

The problem is that since my application pages has various ajax-components in it and not every request results in the whole page being rendered, i am not sure which component to attach this ajaxTimerBehavior with, such that the AjaxTimerBehavior's timer is updated accordingly with every ajax-request (as well).

Can anyone suggest as to what would be the right way to go with this, or an alternate solution to the above requirement..

Thanks in advance and Regards,

Farhan.

Re: Automatic redirection to Expiry Page once the session timeout is reached - Possible options

by mfs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another point worth mentioning in the solution i discussed in my earlier post is that i would want the ajax timer-based event (with the help of ajaxTimerbehavior) to be invoked ONLY when the session-timeout period has reached, as otherwise the ajax-event would unnecessarily result in the extension of the session-timeout period of the app, without any user event, something i certainly don't want.

It is the above reason, why i mentioned in my earlier post, that i would want to update the timer period on every ajax request, as otherwise the ajax-event would be invoked based on the time-set on AjaxTimerBehavior component when the page was first rendered AND not based on the actual session-timeout period, which would have changed, had there been any ajax-based communication after the page was first rendered.

Hope it make sense..

Thanks

mfs wrote:
Guys,

I wanted to add this feature in my application, where once the session-timeout period is reached, the user is automatically redirected to the session-expiry page, like the way you might have seen in various banking sites.

In order to achieve the above the first component which came to my mind was AbstractAjaxTimerBehavior, on which i set the to event-invocation-time to => "session-timeout_period + 1 mill-sec (or 1 sec)", where when the ajax-event is invoked (once the timeout is reached), the wicket framework would automatically redirect the user to the session-expiry page.

The problem is that since my application pages has various ajax-components in it and not every request results in the whole page being rendered, i am not sure which component to attach this ajaxTimerBehavior with, such that the AjaxTimerBehavior's timer is updated accordingly with every ajax-request (as well).

Can anyone suggest as to what would be the right way to go with this, or an alternate solution to the above requirement..

Thanks in advance and Regards,

Farhan.

Re: Automatic redirection to Expiry Page once the session timeout is reached - Possible options

by Timo Rantalaiho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 07 Jul 2008, mfs wrote:
> The problem is that since my application pages has various ajax-components
> in it and not every request results in the whole page being rendered, i am
> not sure which component to attach this ajaxTimerBehavior with, such that
> the AjaxTimerBehavior's timer is updated accordingly with every ajax-request
> (as well).

Maybe you can create your custom RequestCycle and do something
like this

@Override public void detach() {
    try {
        AjaxRequestTarget target = AjaxRequestTarget.get();
        target.addComponent(Mysession.get().getSessionExpiryComponent());
    } finally {
        super.detach();
    }
}

I'm not sure if it would work, but in general RequestCycle can
be used for making hooks in every request processing.

Best wishes,
Timo

--
Timo Rantalaiho          
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: Automatic redirection to Expiry Page once the session timeout is reached - Possible options

by mfs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Timo,
Thanks for the followup, i will give this a try, though i doubt it work given my understanding that components rendering are linked with an html page, and in this case i am not sure how would the request-cycle would bind the target component to one..

Thanks


Timo Rantalaiho wrote:
On Mon, 07 Jul 2008, mfs wrote:
> The problem is that since my application pages has various ajax-components
> in it and not every request results in the whole page being rendered, i am
> not sure which component to attach this ajaxTimerBehavior with, such that
> the AjaxTimerBehavior's timer is updated accordingly with every ajax-request
> (as well).

Maybe you can create your custom RequestCycle and do something
like this

@Override public void detach() {
    try {
        AjaxRequestTarget target = AjaxRequestTarget.get();
        target.addComponent(Mysession.get().getSessionExpiryComponent());
    } finally {
        super.detach();
    }
}

I'm not sure if it would work, but in general RequestCycle can
be used for making hooks in every request processing.

Best wishes,
Timo

--
Timo Rantalaiho          
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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

Re: Automatic redirection to Expiry Page once the session timeout is reached - Possible options

by Timo Rantalaiho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 08 Jul 2008, mfs wrote:
> Thanks for the followup, i will give this a try, though i doubt it work
> given my understanding that components rendering are linked with an html
> page, and in this case i am not sure how would the request-cycle would bind
> the target component to one..

Ajax requests all also processed within RequestCycles.

Best wishes,
Timo

--
Timo Rantalaiho          
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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

LightInTheBox - Buy quality products at wholesale price