You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Pups <va...@devcom.com> on 2011/06/09 19:57:39 UTC

Tapestry 5.1.10 Links in Chrome and IE9

Hello everybody,

Let's me try to describe my issue.
I've some ActionLink on the component and when I click it my Tapestry
application generate some link and return it 
part of code is here

public Object onActionFromAddToBundleCart() throws ShoppingCartException {
...
	Link addProductsToCartLink =
pageRenderLinkSource.createPageRenderLinkWithContext(BundleAddToCart.class,
addToCartContext.toArray());
	addProductsToCartLink.addParameter("return_url", returnUrl);
	return addProductsToCartLink;
}

Page BundleAddToCart works properly. When I use Firefox (any version) I have
link like this

http://myserver/BundleAddToCart/contextItem1/contextItem2/contextItem3/contextItem4?return_url=http://externalserver/somecontext/

And everything works. But when I try to use Google Chrome browser or IE9 I
have some strange behaviour.
I see that tapestry parse all string with pattern "/" and I have incorrect
url parameter message like this "contextItem4?return_url=http:" is
incorrect... 
Ok, I'm trying to encode return_url parameter before calling 
addParameter("return_url", returnUrl)

and as a result I have correct link seemingly...

http://myserver/BundleAddToCart/contextItem1/contextItem2/contextItem3/contextItem4?return_url=http%3A%2F%2Fexternalserver%2Fsomecontext%2F

But when this link doesn't return to Tapestry. In the response header I see
the following 
Connection:close
Content-Length:0
Date:Thu, 09 Jun 2011 17:49:15 GMT
Server:Apache-Coyote/1.1

and in the address bar I see the link like this

http://myserver/BundleAddToCart/contextItem1/contextItem2/contextItem3/contextItem4%3Freturn_url=http%3A%2F%2Fexternalserver%2Fsomecontext%2F

('?' encoded to '%3F' ).

In the IE9 the same behaviour.

One thing I've noticed. This start to occure after I've added to my project
described here 

http://tapestry.1045711.n5.nabble.com/Re-Prototype-IE9-update-td4331824.html

What's wrong? There is my error? Please HELP. I spent 3 days trying to
resolve current issue.


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-10-Links-in-Chrome-and-IE9-tp4473624p4473624.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Tapestry 5.1.10 Links in Chrome and IE9

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 10 Jun 2011 04:31:00 -0300, Pups <va...@devcom.com> wrote:

> Hello.
> I use this encoding

Hi!

> String encodedUrl = getRequestedUrl();
> encodedUrl = java.net.URLEncoder.encode(encodedUrl,
> requestGlobals.getHTTPServletRequest().getCharacterEncoding());
> return encodedUrl;

You can @Inject HttpServletRequest directly. No need to use RequestGlobals  
for that.

> As I see in debug it is "UTF-8".

You shouldn't use the request encoding, as it can vary between browsers,  
so I'd use UTF-8 explicitly.

Connection:close
Content-Length:0
Date:Thu, 09 Jun 2011 17:49:15 GMT
Server:Apache-Coyote/1.1

Have you tried this without using Apache in the front of Tomcat/Jetty?

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Tapestry 5.1.10 Links in Chrome and IE9

Posted by Pups <va...@devcom.com>.
Hello.
I use this encoding

String encodedUrl = getRequestedUrl();
encodedUrl = java.net.URLEncoder.encode(encodedUrl,
requestGlobals.getHTTPServletRequest().getCharacterEncoding());

return encodedUrl;

As I see in debug it is "UTF-8".

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-1-10-Links-in-Chrome-and-IE9-tp4473624p4475440.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Tapestry 5.1.10 Links in Chrome and IE9

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 09 Jun 2011 14:57:39 -0300, Pups <va...@devcom.com> wrote:

> Hello everybody,

Hi!

> Ok, I'm trying to encode return_url parameter before calling
> addParameter("return_url", returnUrl)

You should do that yourself, as the method documentation says: "Adds a  
parameter value. The value will be added, as is, to the URL. In many  
cases, the value should be URL encoded via URLEncoder. Which encoding are  
you using? Out-of-the-box, Tapestry uses UTF-8, so should you.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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