users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Re: UriBuilder.segment and build with encodePathSlash

From: Markus KARG <markus_at_headcrashing.eu>
Date: Tue, 23 Oct 2012 19:50:05 +0200

If you are not too disappointed I'd like to follow Marek and ask you to
check the discussion in the mail archive.

In short, I do not want any special rules but instead want a stable working
API for this scenario:

@Path("{a}")
...
UriBuilder.fromResource().build(dataFromDatabase)

does simply not work otherwise. As Marek just said, it is the only correctly
working and stable solution. Adding another method wrapping
"dataFromDatabase" is simply ridiculous and overly complex, as there already
are exactly two methods, one that MUST encode (build) and one that MUST NOT
encode (buildFromEncoded) and there is absolute no *need* for anything more.
Forcing a need to wrap all database calls is ridiculous as those are the
majority of cases.

If you want people to not get encoded slashes, either make them write the
slashes not into build() but into path(), or make them add a boolean to
build().

Thanks
Markus

> Markus, I personally find it very weird that '/' would ever be
> automatically encoded in a path template variable as it is a valid path
> character as per the URI RFC. IMO, if you want special encoding rules
> that are different than what is specified in the URI RFC's, then, IMO,
> you should have to manually encode them, or have us provide a method
> that encodes a string for you.