dev@jsr311.java.net

Re: URI Escaping and Unescaping

From: Bill de hOra <bill_at_dehora.net>
Date: Thu, 21 Jun 2007 18:59:55 +0100

Paul Sandoz wrote:

> If we don't decode then a developer will spend time debugging a problem
> to find that funny characters are present in the template values. On the
> hand if we do decode a developer will spend time debugging URI creation
> exceptions. Both are a source of nasty sleeper bugs :-(

Indeed. For me to add

   @UriTemplate("hello%20world")

means I need to know the escape sequence as I type. The doing this

     @UriTemplate("hello world")

will be an exception (?), as it's not legal syntax.

OTOH, auto-encoding will surely confuse someone. That said, do people
expect a programmatic API to do de/encode? I can't think of a web
framework that does that (surely servlets don't handle escaping in
servlet-mapping?). I can think of weblogs and plone that generate a
"slug" off something like a title, but that's a userspace feature.

cheers
Bill