Re: JAX-RS: UriBuilder encoding

  • From: Stephan Koops <Stephan.Koops@...>
  • To: users@...
  • Subject: Re: JAX-RS: UriBuilder encoding
  • Date: Wed, 23 Jul 2008 21:34:19 +0200
  • Mailing-list: contact users-help@...; run by ezmlm

Hi Marc
On Jul 23, 2008, at 3:06 PM, Stephan Koops wrote:
I think the current approach with the encode attribute is very easy to use. Your proposal will produce boilerplate code, because you have to manually call the encode methods. This will not improve the readability of resource method code, especially if you get data from somewhere (databse e.g.) and want to use it for building URIs.
I don't think it will introduce additional boiler plate code since all methods will always do encoding. The main change is how we deal with pct-encoded chars in values passed to builder methods. Before in encode=true mode we treated % as a char that needed to be encoded, now we will be smarter and only encode it if its not part of a pct-encoded value.
I agree, that we should support this.
If you want to work with pct-encoded data the builder methods will ignore the escaped octets anyway and if you work with decoded data the methods will automatically encode stuff for you.
For path segments I agree, but not for matrix parameters and the query. If I want to build an URI with a string, where all characters could be in, e.g. "20%20" and the second "20" should not be treated as part of a precent encoded space, so that it should be decoded to "20%2520", than you need the boilerplate code. And this is always the case, where a '%' sign is allowed (perhaps not for daily use, but allowed).

What about add build methods, where you could give an encode state? But UriBuilder.buildFromMap(Map, boolean) is no problem, but UriBuilder.build(Object..., boolean) won't work. What about UriBuilder.buildEncode(Object...), which encode all characters, and UriBuilder.build(Object...) only the characters that must be converted?

What's the problem with adding a third state for the encode attribute, and let all other as it is?

best regards
  Stephan




Re: JAX-RS: UriBuilder encoding

(continued)

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/16/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/16/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/16/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/16/2008

RE: JAX-RS: UriBuilder encoding

Manger, James H 07/17/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/17/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/22/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/23/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/23/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/23/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/23/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/23/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/23/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/24/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/24/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/24/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/24/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/24/2008

Re: JAX-RS: UriBuilder encoding

Marc Hadley 07/24/2008

RE: JAX-RS: UriBuilder encoding

Manger, James H 07/18/2008

Re: JAX-RS: UriBuilder encoding

Stephan Koops 07/18/2008
Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150626.29986a4)
 
 
Close
loading
Please Confirm
Close