Pages

Saturday, May 8, 2010

The mystifying URL Encoding

I just found out about this things. I never really care about the difference between URL and URI. Whatever it is I just figured it will point to a resource somewhere in the internet. For all i know they can be used interchangeably, so far.

It turn out, when you're trying to generate your own URL programmatic-ally , it matters. One thing to know, that it encode space differently. URL will encode space into + as demand by html 4.0 specification. While with URI you can get the usual %20 character.

And what more annoying is this fact.  That you can't simply use URLEncoder to encode and decode URL, but you need to create a URI then execute the toURL() method.

Tapestry URL


Now something specific about tapestry. Since I'm creating an android client that will talk with tapestry server. I need to generate my own URL. In this URL fiasco it turn out that tapestry has its own URL Encoding policy. You can see the change in this jira. Tapestry substitute the '%' character with '$00'.

Luckily the you can get tapestry URLEncoder implementation from tapestry code. So i just use that class in my android app. And one problem solved.

Oh another thing i found out. Tapestry page isn't debug able with eclipse WTP. But the services are.

Cheers

~FD

No comments: