dev@jsr311.java.net

Re: URI Escaping and Unescaping

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 26 Jun 2007 11:12:37 -0400

On Jun 25, 2007, at 6:32 PM, Dhanji R. Prasanna wrote:
>
> @UriParam, @QueryParam, @MatrixParam - add a boolean 'decode'
> property with a default value of true.
>
>
> +1. You beat me to it. I was actually going to suggest
> autoDecode="true"
>
> I would still encourage keeping the value method rather than
> renaming it:
> @UriParam(value="paramname", autoDecode=false)
>
+1, I wasn't suggesting we change it.

> because it lets you use the shorthand:
> @UriParam("paramname")
>
Exactly.

> On more thought I think we should consider Paul's solution as it is
> more elegant; because you can do:
>
> @Decode @HttpMethod
> public void get(@UriParam("param1") String p1, @UriParam("param2")
> String p2, ....) { }
>
> without being explicit on each parameter (or overriding on each as
> required). You can even declare @Decode on an entire type as a
> shortcut.
>
Yes, that is more flexible. However, @Decode would switch the default
(no annotation) from decoded to encoded and IMO we should default to
automatic decoding. How about @Encoded instead, you can annotate a
method or method parameter if you want to disable the automatic
decoding of parameter values ?

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.