You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pepijn de Geus <pe...@service2media.com> on 2010/09/30 15:41:29 UTC

continueToOriginalDestination not working correctly

Hi all,

I'm working on a website were the customer can enable a splash page that will be displayed once per session to every visitor entering the site.
To achieve this, I've added a small session check with a to my BasePage, which is the parent of all webpages:

if (!getSession().isSplashShown()) {
    SplashData splash = em.find(SplashData.class, SplashData.ID);
    if (splash.isEnabled()) {
        throw new RestartResponseAtInterceptPageException(SplashWebPage.class);
    } else {
        getSession().setSplashShown();
    }
}

This works like expected; the user is redirected to the URL the SplashWebPage is mounted on.
On the SplashWebPage, which does not extends BasePage, I've added a AjaxFallbackLink like this:

session.setSplashShown();



add(new AjaxFallbackLink<Void>("close") {
    private static final long serialVersionUID = 1L;

    public void onClick(AjaxRequestTarget target) {
        if (!continueToOriginalDestination()) {
            setResponsePage(HomePage.class);
        }
    }
});

Clicking this links does not work. The log tells me:

"ClassName=org.apache.wicket.protocol.http.WebResponse;MethodName=redirect;....|Redirecting to "
(nothing after 'to', only a space)

and the AJAX response reads:

<ajax-response><redirect></redirect></ajax-response>

I was able to solve this issue by either:
- Changing the link to a non-ajax one
- Mounting the SplashWebPage on a path 'deeper' then the one the user originally tried te open, such as "/splash/work/please". The user is then redirected to "../../" correctly.

It this a bug in Wicket, or am I doing something stupid?

Thanks in advance,
Pepijn

RE: continueToOriginalDestination not working correctly

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
I had a problem using continueToOriginalDestination with very similar
symptoms that was only a problem for IE? Does yours affect all browsers
or just IE? My problem only occurred in IE and only if the redirection
was to the root of the app, redirecting to any folder *under* the root
worked fine - very similar to what you state.

At the time I raised issue:

https://issues.apache.org/jira/browse/WICKET-2912

but it has since been marked as 'cannot reproduce' so I thought it must
have been some querky issue with my particular app.

I'm not sure if this is the same as your problem but I fixed the problem
in my environment by making a change to the wicket source code
(org.apache.wicket.PageMap:continueToOriginalDestination() which I have
outlined in a comment in the above JIRA page. It basically involves an
extra test of the interceptionContinuationURL and then a subsequent
stripping of the any leading '/'.

From:

		// If there's a place to go to
		if (interceptContinuationURL != null)
		{
			...
		}

to this:


		// If there's a place to go to
		if (interceptContinuationURL != null)
		{
			if ( interceptContinuationURL.length() > 0 &&
interceptContinuationURL.charAt(0) == '/' )
	interceptContinuationURL =
interceptContinuationURL.substring(1);	

			...
		}

And now it works fine on IE as well.

>-----Original Message-----
>From: Pepijn de Geus [mailto:pepijn@service2media.com]
>Sent: Thursday, 30 September 2010 11:41 PM
>To: users@wicket.apache.org
>Subject: continueToOriginalDestination not working correctly
>
>Hi all,
>
>I'm working on a website were the customer can enable a splash page
that
>will be displayed once per session to every visitor entering the site.
>To achieve this, I've added a small session check with a to my
BasePage,
>which is the parent of all webpages:
>
>if (!getSession().isSplashShown()) {
>    SplashData splash = em.find(SplashData.class, SplashData.ID);
>    if (splash.isEnabled()) {
>        throw new
>RestartResponseAtInterceptPageException(SplashWebPage.class);
>    } else {
>        getSession().setSplashShown();
>    }
>}
>
>This works like expected; the user is redirected to the URL the
>SplashWebPage is mounted on.
>On the SplashWebPage, which does not extends BasePage, I've added a
>AjaxFallbackLink like this:
>
>session.setSplashShown();
>
>
>
>add(new AjaxFallbackLink<Void>("close") {
>    private static final long serialVersionUID = 1L;
>
>    public void onClick(AjaxRequestTarget target) {
>        if (!continueToOriginalDestination()) {
>            setResponsePage(HomePage.class);
>        }
>    }
>});
>
>Clicking this links does not work. The log tells me:
>
>"ClassName=org.apache.wicket.protocol.http.WebResponse;MethodName=redir
ect;
>....|Redirecting to "
>(nothing after 'to', only a space)
>
>and the AJAX response reads:
>
><ajax-response><redirect></redirect></ajax-response>
>
>I was able to solve this issue by either:
>- Changing the link to a non-ajax one
>- Mounting the SplashWebPage on a path 'deeper' then the one the user
>originally tried te open, such as "/splash/work/please". The user is
then
>redirected to "../../" correctly.
>
>It this a bug in Wicket, or am I doing something stupid?
>
>Thanks in advance,
>Pepijn

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


Re: continueToOriginalDestination not working correctly

Posted by Igor Vaynberg <ig...@gmail.com>.
i dont think we support continuetoorig via ajax

-igor

On Thu, Sep 30, 2010 at 6:41 AM, Pepijn de Geus
<pe...@service2media.com> wrote:
> Hi all,
>
> I'm working on a website were the customer can enable a splash page that will be displayed once per session to every visitor entering the site.
> To achieve this, I've added a small session check with a to my BasePage, which is the parent of all webpages:
>
> if (!getSession().isSplashShown()) {
>    SplashData splash = em.find(SplashData.class, SplashData.ID);
>    if (splash.isEnabled()) {
>        throw new RestartResponseAtInterceptPageException(SplashWebPage.class);
>    } else {
>        getSession().setSplashShown();
>    }
> }
>
> This works like expected; the user is redirected to the URL the SplashWebPage is mounted on.
> On the SplashWebPage, which does not extends BasePage, I've added a AjaxFallbackLink like this:
>
> session.setSplashShown();
>
>
>
> add(new AjaxFallbackLink<Void>("close") {
>    private static final long serialVersionUID = 1L;
>
>    public void onClick(AjaxRequestTarget target) {
>        if (!continueToOriginalDestination()) {
>            setResponsePage(HomePage.class);
>        }
>    }
> });
>
> Clicking this links does not work. The log tells me:
>
> "ClassName=org.apache.wicket.protocol.http.WebResponse;MethodName=redirect;....|Redirecting to "
> (nothing after 'to', only a space)
>
> and the AJAX response reads:
>
> <ajax-response><redirect></redirect></ajax-response>
>
> I was able to solve this issue by either:
> - Changing the link to a non-ajax one
> - Mounting the SplashWebPage on a path 'deeper' then the one the user originally tried te open, such as "/splash/work/please". The user is then redirected to "../../" correctly.
>
> It this a bug in Wicket, or am I doing something stupid?
>
> Thanks in advance,
> Pepijn
>

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