You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Oleg Gulyaev <fu...@gmail.com> on 2014/01/29 16:01:35 UTC

No redirect if current client url equals redirect url

Hi all!

I return a link from an ajax event handler, which can refresh zone or redirect to some url. In some situations, client get redirect url which equals his currently open page url, and Tapestry don’t redirect in this case (as I understood, this mechanism is somewhere in Tapestry .js core). 

For a number of reasons, I can’t track equality of the links, so I can’t just refresh page in this situation.

Can I somehow force Tapestry to redirect user to same url?

Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: No redirect if current client url equals redirect url

Posted by Oleg Gulyaev <fu...@gmail.com>.
> I created jira TAP5-2279

Thanks for your help! It will be a useful fix.

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


Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
I created jira TAP5-2279
 On 30 Jan 2014 09:30, "Lance Java" <la...@googlemail.com> wrote:

> It sounds like the browser is trying to be smart. Please file a jira.
>
> I guess we need some clientside logic to refresh the page if the URL is
> the same.
>

Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
It sounds like the browser is trying to be smart. Please file a jira.

I guess we need some clientside logic to refresh the page if the URL is the
same.

Re: No redirect if current client url equals redirect url

Posted by Oleg Gulyaev <fu...@gmail.com>.
On 30 янв. 2014 г., at 11:59, Lance Java <la...@googlemail.com> wrote:

> I wonder if this is a browser 'feature' (ie only refresh if the URL changes
> from current)
> 
> Do you see this behaviour in all browsers?

Same behavior on Chrome, Firefox, Opera on Ubuntu and Safari on Mac OS X.

Well, it seems like browser behavior. To fix it, I made a little cheat - added fake request parameter with random value to URL to get different URL. This solution works, but smells a little :)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
FYI I'm assuming Tapestry does something like

window.location.href = redirectURL
 On 30 Jan 2014 07:59, "Lance Java" <la...@googlemail.com> wrote:

> Hmm... Looks good to me.
>
> I wonder if this is a browser 'feature' (ie only refresh if the URL
> changes from current)
>
> Do you see this behaviour in all browsers?
> On 30 Jan 2014 07:27, "Oleg Gulyaev" <fu...@gmail.com> wrote:
>
>> Yes, I found it, here it is:
>>
>> {
>>         "redirectURL" : "/comments/52e9f9e5e4b0ba0bb0273298/3?page=1#com"
>> }
>>
>> On 30 янв. 2014 г., at 11:23, Lance Java <la...@googlemail.com>
>> wrote:
>>
>> > I want to see the response body which will be a json string.
>> > On 30 Jan 2014 07:20, "Oleg Gulyaev" <fu...@gmail.com> wrote:
>> > On 29 янв. 2014 г., at 19:37, Lance Java <la...@googlemail.com>
>> wrote:
>> >
>> >> Can you post the response body from the ajax request? (using dev tools
>> in
>> >> your browser)
>> >
>> > I wasn’t sure exactly what you need, so I made a screenshot of whole
>> ajax request data (see in attach).
>> >
>> >
>>
>>

Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
Hmm... Looks good to me.

I wonder if this is a browser 'feature' (ie only refresh if the URL changes
from current)

Do you see this behaviour in all browsers?
On 30 Jan 2014 07:27, "Oleg Gulyaev" <fu...@gmail.com> wrote:

> Yes, I found it, here it is:
>
> {
>         "redirectURL" : "/comments/52e9f9e5e4b0ba0bb0273298/3?page=1#com"
> }
>
> On 30 янв. 2014 г., at 11:23, Lance Java <la...@googlemail.com>
> wrote:
>
> > I want to see the response body which will be a json string.
> > On 30 Jan 2014 07:20, "Oleg Gulyaev" <fu...@gmail.com> wrote:
> > On 29 янв. 2014 г., at 19:37, Lance Java <la...@googlemail.com>
> wrote:
> >
> >> Can you post the response body from the ajax request? (using dev tools
> in
> >> your browser)
> >
> > I wasn’t sure exactly what you need, so I made a screenshot of whole
> ajax request data (see in attach).
> >
> >
>
>

Re: No redirect if current client url equals redirect url

Posted by Oleg Gulyaev <fu...@gmail.com>.
Yes, I found it, here it is:

{
	"redirectURL" : "/comments/52e9f9e5e4b0ba0bb0273298/3?page=1#com"
}

On 30 янв. 2014 г., at 11:23, Lance Java <la...@googlemail.com> wrote:

> I want to see the response body which will be a json string. 
> On 30 Jan 2014 07:20, "Oleg Gulyaev" <fu...@gmail.com> wrote:
> On 29 янв. 2014 г., at 19:37, Lance Java <la...@googlemail.com> wrote:
> 
>> Can you post the response body from the ajax request? (using dev tools in
>> your browser)
> 
> I wasn’t sure exactly what you need, so I made a screenshot of whole ajax request data (see in attach).
> 
> 


Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
I want to see the response body which will be a json string.
 On 30 Jan 2014 07:20, "Oleg Gulyaev" <fu...@gmail.com> wrote:

> On 29 янв. 2014 г., at 19:37, Lance Java <la...@googlemail.com>
> wrote:
>
> Can you post the response body from the ajax request? (using dev tools in
> your browser)
>
>
> I wasn’t sure exactly what you need, so I made a screenshot of whole ajax
> request data (see in attach).
>
>

Re: No redirect if current client url equals redirect url

Posted by Oleg Gulyaev <fu...@gmail.com>.
On 29 янв. 2014 г., at 19:37, Lance Java <la...@googlemail.com> wrote:

> Can you post the response body from the ajax request? (using dev tools in
> your browser)

I wasn’t sure exactly what you need, so I made a screenshot of whole ajax request data (see in attach).


Re: No redirect if current client url equals redirect url

Posted by Lance Java <la...@googlemail.com>.
Can you post the response body from the ajax request? (using dev tools in
your browser)

Re: No redirect if current client url equals redirect url

Posted by Oleg Gulyaev <fu...@gmail.com>.
On 29 янв. 2014 г., at 20:31, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:

> That's weird, because if you return a Link in an event handler, no matter if it's called by AJAX or not, it should cause a redirection. If not, check whether some exception happened server- or client-side.

I checked, no server- or client-side exceptions.

> If not in an AJAX request, you can just return 'this' (without quotes). If yes, create a Link using the PageRenderLinkCreatorSource service and one of hte createPageRenderLink() methods.

Yes, I create the link using PageRenderLinkSource.


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


Re: No redirect if current client url equals redirect url

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 29 Jan 2014 13:01:35 -0200, Oleg Gulyaev <fu...@gmail.com>  
wrote:

> Hi all!

Hi!

> I return a link from an ajax event handler, which can refresh zone or  
> redirect to some url.

That's weird, because if you return a Link in an event handler, no matter  
if it's called by AJAX or not, it should cause a redirection. If not,  
check whether some exception happened server- or client-side.

> Can I somehow force Tapestry to redirect user to same url?

If not in an AJAX request, you can just return 'this' (without quotes). If  
yes, create a Link using the PageRenderLinkCreatorSource service and one  
of hte createPageRenderLink() methods.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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