Re: JSR311: URI-based conneg support

From: Stephan Koops <>
Date: Sat, 17 May 2008 10:50:50 +0200

Hi Marc,

sounds good to me.
To (iii): You mean rename UriInfo.getPathExtension() to something like
getConnegExtensions() ?


Marc Hadley schrieb:
> While building our demo for JavaOne we ran into some usability issues
> with the current support for URI-based conneg. Currently the URIs
> returned by UriInfo are the actual request URIs rather than those used
> in matching after URI preprocessing (see section 3.7.1 of the spec). E.g.
> GET /foo/bar.html with an ApplicationConfig that maps "html" =>
> "text/html"
> UriInfo.getRequestURIBuilder().path("baz").build() => "/foo/bar.html/baz"
> This isn't generally what you want. You can do:
> UriInfo.getPlatonicRequestUriBuilder().path("baz").build() =>
> "/foo/bar/baz"
> which is better, but you have to remeber to use the platonic builder
> and often what you really want to get is "/foo/bar/baz.html", so then
> you have to do
> UriInfo.getPlatonicRequestUriBuilder().path("baz").entension(UriInfo.getPathExtension()).build()
> We think it would be better if you could just write:
> UriInfo.getRequestURIBuilder().path("baz").build() => "/foo/bar/baz.html"
> To do this we propose the following changes:
> (i) change the way that UriInfo works such that the URIs returned are
> post-section.3.7.1-processing
> (ii) remove the "platonic" URIs from UriInfo as all methods are now
> platonic.
> (iii) change the getPathExtension method so that it returns the
> extension extracted by section.3.7.1 processing - we'd also rename it
> in the process.
> (iv) change the semantics of UriBuilder.extension so that it specifies
> an extension that will be appended to the final path segment during
> build().
> (v) add a new UriBuilder method to get the current value of (iv)
> (vi) Specify that the UriInfo methods that return a UriBuilder set the
> extension property (iv) based on the current value of (iii).
> With these changes the URIs you get from UriInfo correspond to those
> used in matching requests to resources (as is already the case for the
> rewritten Accept and Accept-Language headers). Builders you get from
> URI info are preconfigured to use the same URI-based conneg that the
> request used so its easy to build representations with links to
> representations using the same media type and language. Its also easy
> to build platonic URIs just by unsetting the value of (iv) after you
> obtain the builder from UriInfo.
> Thoughts, comments ?
> Marc