You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by leok <le...@gmail.com> on 2007/10/03 04:14:00 UTC

Graceful handling of ajax after session expiration

Hi there - I'm trying to add some graceful handling of ajax behavior during
session expiration in my Wicket webapp. Is there a way to not redirect to
the session expired page and invoke some other handler, using either a
wicket component and/or javascript function, after the session has expired?

Ideally, Ajax calls would continue to function after session expiration.
I've scanned the list regarding this issue, and I think it makes sense for
certain types of ajax requests, e.g. ajax requests that resemble stateless
form interaction. Is there a way to hack this sort of behavior with Wicket?

Thanks,
leo
-- 
View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Graceful handling of ajax after session expiration

Posted by Andrew Klochkov <a....@webalta-team.com>.
Shouldn't we create a JIRA issue for that?

leok wrote:
> I looked into this a bit more, and it looks like
> WebRequestCycleProcessor.resolve(RequestCycle, RequestParameters) always
> checks to see if an Ajax request is being made before a Page gets to be
> instantiated and stored in the session. If the Page doesn't exist in the
> PageMap, the request simply redirects to the Session Expired page. It seems
> like the Page could be created if its information were encoded in the Ajax
> request.
>
> Is there a reason why an AjaxLink couldn't encode a stateless URL a la
> BookmarkablePageRequestTargetUrlCodingStrategy s.t. the Ajax'ed component
> and its containing page could be created if the page didn't exist in the
> PageMap?
>
>
> leok wrote:
>   
>> Thanks for the response! I'm not sure if this solves my problem though, or
>> if I understand this correctly. Even if I use HybridUrlCodingStrategy to
>> mount the page, I will still get redirected to a "Session Expired" page if
>> I try to use any ajax-enabled component. 
>>
>> A second problem emerges when I get redirected to the Session Expired
>> page, hit the back button, and attempt to invoke the ajax-enabled
>> component again. This time Wicket thinks I'm sending the ajax request to
>> the Session Expired page and redirects me to a plain old error page with a
>> stack trace. 
>>
>> It'd be nice to be able to register Wicket ajax components in some state
>> that persists beyond a single user's session. 
>>
>>
>> Martijn Dashorst wrote:
>>     
>>> 1.3 has a new URL encoding strategy that would make this somehow
>>> possible: iirc it is the hybrid url coding strategy, and is for
>>> instance used at http://thoof.com
>>>
>>> The url becomes bookmarkable, and has the page nr and version number
>>> encoded in the url, but wicket will use the bookmarkable part when
>>> there is not session.
>>>
>>> Martijn
>>>
>>> On 10/3/07, leok <le...@gmail.com> wrote:
>>>       
>>>> Hi there - I'm trying to add some graceful handling of ajax behavior
>>>> during
>>>> session expiration in my Wicket webapp. Is there a way to not redirect
>>>> to
>>>> the session expired page and invoke some other handler, using either a
>>>> wicket component and/or javascript function, after the session has
>>>> expired?
>>>>
>>>> Ideally, Ajax calls would continue to function after session expiration.
>>>> I've scanned the list regarding this issue, and I think it makes sense
>>>> for
>>>> certain types of ajax requests, e.g. ajax requests that resemble
>>>> stateless
>>>> form interaction. Is there a way to hack this sort of behavior with
>>>> Wicket?
>>>>
>>>> Thanks,
>>>> leo
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>>> -- 
>>> Buy Wicket in Action: http://manning.com/dashorst
>>> Apache Wicket 1.3.0-beta3 is released
>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>       
>>     
>
>   


-- 
Andrew Klochkov


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


Re: Graceful handling of ajax after session expiration

Posted by leok <le...@gmail.com>.
I looked into this a bit more, and it looks like
WebRequestCycleProcessor.resolve(RequestCycle, RequestParameters) always
checks to see if an Ajax request is being made before a Page gets to be
instantiated and stored in the session. If the Page doesn't exist in the
PageMap, the request simply redirects to the Session Expired page. It seems
like the Page could be created if its information were encoded in the Ajax
request.

Is there a reason why an AjaxLink couldn't encode a stateless URL a la
BookmarkablePageRequestTargetUrlCodingStrategy s.t. the Ajax'ed component
and its containing page could be created if the page didn't exist in the
PageMap?


leok wrote:
> 
> Thanks for the response! I'm not sure if this solves my problem though, or
> if I understand this correctly. Even if I use HybridUrlCodingStrategy to
> mount the page, I will still get redirected to a "Session Expired" page if
> I try to use any ajax-enabled component. 
> 
> A second problem emerges when I get redirected to the Session Expired
> page, hit the back button, and attempt to invoke the ajax-enabled
> component again. This time Wicket thinks I'm sending the ajax request to
> the Session Expired page and redirects me to a plain old error page with a
> stack trace. 
> 
> It'd be nice to be able to register Wicket ajax components in some state
> that persists beyond a single user's session. 
> 
> 
> Martijn Dashorst wrote:
>> 
>> 1.3 has a new URL encoding strategy that would make this somehow
>> possible: iirc it is the hybrid url coding strategy, and is for
>> instance used at http://thoof.com
>> 
>> The url becomes bookmarkable, and has the page nr and version number
>> encoded in the url, but wicket will use the bookmarkable part when
>> there is not session.
>> 
>> Martijn
>> 
>> On 10/3/07, leok <le...@gmail.com> wrote:
>>>
>>> Hi there - I'm trying to add some graceful handling of ajax behavior
>>> during
>>> session expiration in my Wicket webapp. Is there a way to not redirect
>>> to
>>> the session expired page and invoke some other handler, using either a
>>> wicket component and/or javascript function, after the session has
>>> expired?
>>>
>>> Ideally, Ajax calls would continue to function after session expiration.
>>> I've scanned the list regarding this issue, and I think it makes sense
>>> for
>>> certain types of ajax requests, e.g. ajax requests that resemble
>>> stateless
>>> form interaction. Is there a way to hack this sort of behavior with
>>> Wicket?
>>>
>>> Thanks,
>>> leo
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> 
>> 
>> -- 
>> Buy Wicket in Action: http://manning.com/dashorst
>> Apache Wicket 1.3.0-beta3 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13042041
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Graceful handling of ajax after session expiration

Posted by leok <le...@gmail.com>.
Thanks for the response! I'm not sure if this solves my problem though, or if
I understand this correctly. Even if I use HybridUrlCodingStrategy to mount
the page, I will still get redirected to a "Session Expired" page if I try
to use any ajax-enabled component. 

A second problem emerges when I get redirected to the Session Expired page,
hit the back button, and attempt to invoke the ajax-enabled component again.
This time Wicket thinks I'm sending the ajax request to the Session Expired
page and redirects me to a plain old error page with a stack trace. 

It'd be nice to be able to register Wicket ajax components in some state
that persists beyond a single user's session. 


Martijn Dashorst wrote:
> 
> 1.3 has a new URL encoding strategy that would make this somehow
> possible: iirc it is the hybrid url coding strategy, and is for
> instance used at http://thoof.com
> 
> The url becomes bookmarkable, and has the page nr and version number
> encoded in the url, but wicket will use the bookmarkable part when
> there is not session.
> 
> Martijn
> 
> On 10/3/07, leok <le...@gmail.com> wrote:
>>
>> Hi there - I'm trying to add some graceful handling of ajax behavior
>> during
>> session expiration in my Wicket webapp. Is there a way to not redirect to
>> the session expired page and invoke some other handler, using either a
>> wicket component and/or javascript function, after the session has
>> expired?
>>
>> Ideally, Ajax calls would continue to function after session expiration.
>> I've scanned the list regarding this issue, and I think it makes sense
>> for
>> certain types of ajax requests, e.g. ajax requests that resemble
>> stateless
>> form interaction. Is there a way to hack this sort of behavior with
>> Wicket?
>>
>> Thanks,
>> leo
>> --
>> View this message in context:
>> http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> -- 
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13021459
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Graceful handling of ajax after session expiration

Posted by Martijn Dashorst <ma...@gmail.com>.
1.3 has a new URL encoding strategy that would make this somehow
possible: iirc it is the hybrid url coding strategy, and is for
instance used at http://thoof.com

The url becomes bookmarkable, and has the page nr and version number
encoded in the url, but wicket will use the bookmarkable part when
there is not session.

Martijn

On 10/3/07, leok <le...@gmail.com> wrote:
>
> Hi there - I'm trying to add some graceful handling of ajax behavior during
> session expiration in my Wicket webapp. Is there a way to not redirect to
> the session expired page and invoke some other handler, using either a
> wicket component and/or javascript function, after the session has expired?
>
> Ideally, Ajax calls would continue to function after session expiration.
> I've scanned the list regarding this issue, and I think it makes sense for
> certain types of ajax requests, e.g. ajax requests that resemble stateless
> form interaction. Is there a way to hack this sort of behavior with Wicket?
>
> Thanks,
> leo
> --
> View this message in context: http://www.nabble.com/Graceful-handling-of-ajax-after-session-expiration-tf4559480.html#a13011817
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

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