Re: URI Escaping and Unescaping

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 22 Jun 2007 21:49:40 +0200

Mark Hansen wrote:
> Thanks for the great example. Yes, actually, the code and behavior you
> descrbie are what I am proposing. And, I would agree with anyone who
> looks at that and says "yuck - Can't we make it prettier than that!".
> So there is the trade-off that this EG has to hash out. Do we want
> attractive code or do we want code that actually reflects what is going
> on on the Internet?

Playing devil's 'avocado' a little with an analogy...

Do you prefer working with escaped character data or literal character
data in XML documents?

Expressing an XML document as a string is a bit similar to expressing a
URI or URI template as a string. But operating on the text content of an
XML document can be a bit like operating on the decoded aspects of a URI.

Maybe we have reasonably APIs, abstractions and models for processing
and producing XML? and perhaps we are lacking these for processing and
producing URIs?

Thus perhaps we could explore what we could do here to see if we could
improve matters?

For example building a URI with the existing stuff is a PITA.
What about a URLBuilder that supports the builder pattern?

   URI u ="").path("/x ).path("y ").
           queryParam("q p", "z ").build();

   URI u = URIBuilder.uri("").path("y ").
           queryParam("q p", "z ").build();


| ? + ? = To question
    Paul Sandoz