Even returning null causes the page to get redirected to Wicket's
"Page Expired" page.

I am using Wicket 1.4.14. Here is the code (referrerUrl is
http://localhost:8080/lrm/ms/oid/389.1)

@Override
public Page onRuntimeException(Page page, RuntimeException e) {

        final HttpServletRequest httpServletRequest = ((WebRequest)
getRequest()).getHttpServletRequest();
        final String referrerUrl = httpServletRequest.getHeader("Referer");
        setRequestTarget(new RedirectRequestTarget(referrerUrl));
        return null;
}

Thoughts?

Thanks,

Alec

On Sat, May 14, 2011 at 2:03 PM, Igor Vaynberg <igor.vaynb...@gmail.com> wrote:
>  setRequestTarget(new RedirectRequestTarget(referrerUrl));
>               return super.onRuntimeException(page, e);
>           }
>
> instead of return super... return null
>
> -igor
>
> On Sat, May 14, 2011 at 11:18 AM, Alec Swan <alecs...@gmail.com> wrote:
>> I put the following code in RequestCycle#onRuntimeException() but it
>> redirects me to Wicket's "Page Expired" page?!
>>
>>       if (e instanceof PageExpiredException) {
>>            final HttpServletRequest httpServletRequest =
>> ((WebRequest) getRequest()).getHttpServletRequest();
>>            final String referrerUrl = 
>> httpServletRequest.getHeader("Referer");
>>
>>            if (referrerUrl != null) {
>>                setRequestTarget(new RedirectRequestTarget(referrerUrl));
>>                return super.onRuntimeException(page, e);
>>            }
>>        }
>>
>> Any ideas?
>>
>> Alec
>>
>> On Sat, May 14, 2011 at 11:21 AM, Alec Swan <alecs...@gmail.com> wrote:
>>> Igor, if I understood correctly you recommend redirecting back to tab2
>>> from the login page. If so, what is the recommended way to do this? Do
>>> I get referrer ULR with ((WebRequest)
>>> getRequest()).getHttpServletRequest().getHeader("Referer") and throw
>>> some kind of exception which redirects back to that URL in LoginPage
>>> constructor or do I call continueToOriginalDestination() in the
>>> LoginPage constructor instead?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Sat, May 14, 2011 at 10:32 AM, Igor Vaynberg <igor.vaynb...@gmail.com> 
>>> wrote:
>>>> i can only assume that tab 2 is either bookmarkable or hybrid. if it
>>>> is, you may be able to check the referer header and if its
>>>> bookmarkable or hybrid redirect back to it.
>>>>
>>>> -igor
>>>>
>>>> On Sat, May 14, 2011 at 9:15 AM, Alec Swan <alecs...@gmail.com> wrote:
>>>>> In our case login page is the home page.
>>>>>
>>>>> Please let me clarify the scenario we need to support:
>>>>>
>>>>> 1. Guest opens the website, clicks on tab1 and stays on it for a while
>>>>> 2. Session times out
>>>>> 3. Guest clicks on tab2
>>>>> Current behavior: Guest is redirected to a login page
>>>>> Desired behavior: Guest is redirected to tab2
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Alec
>>>>>
>>>>> On Sat, May 14, 2011 at 12:10 AM, Igor Vaynberg <igor.vaynb...@gmail.com> 
>>>>> wrote:
>>>>>> so for guests do not return the login page, but a homepage instead...
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Fri, May 13, 2011 at 9:03 PM, Alec Swan <alecs...@gmail.com> wrote:
>>>>>>> The login page is returned from WebRequestCycle#onRuntimeException()
>>>>>>> and Application#getHomePage() and there is also a
>>>>>>> RestartResponseAtInterceptPageException(LOGIN_PAGE) thrown from
>>>>>>> IAuthorizationStrategy#isInstantiationAuthorized().
>>>>>>>
>>>>>>> I am not sure how session timeout is handled by wicket, but I bet some
>>>>>>> kind of runtime exception is thrown causing
>>>>>>> WebRequestCycle#onRuntimeException() to return the login page.
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Alec
>>>>>>>
>>>>>>> On Fri, May 13, 2011 at 6:23 PM, Igor Vaynberg 
>>>>>>> <igor.vaynb...@gmail.com> wrote:
>>>>>>>> what is redirecting them back?
>>>>>>>>
>>>>>>>> -igor
>>>>>>>>
>>>>>>>> On Fri, May 13, 2011 at 3:45 PM, Alec Swan <alecs...@gmail.com> wrote:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> Our webapp has two types of users - Admins and Guests. Guests can view
>>>>>>>>> the site without logging in. However, when the session times out or
>>>>>>>>> load-balancer cookie expires Guests, like Admins are redirected to our
>>>>>>>>> login page, which confuses the Guests.
>>>>>>>>>
>>>>>>>>> What's a good way to redirect Guests back to the page that they were
>>>>>>>>> viewing without keeping the session alive with AJAX pings?
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Alec
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to