users@jax-rs-spec.java.net

[jax-rs-spec users] Mismatch with path parameter handling

From: Thomas Koch <thomas_at_koch.ro>
Date: Fri, 16 Mar 2012 17:57:32 +0100

Hi,

I've an application with uris like
{authority}/{collection}[/{entry}]

Now when handling the GET on collection, I want to build URIs to the entries.
In an ideal world I'd do:

  newParams = Map.of("entry", List.of(entryId))

  uriInfo.getRequestUriBuilder()
           .path(ENTRY_URI_TEMPLATE)
           .buildFromMap(
                 MapsUtil.merge(newParams, uriInfo.getPathParameters())
           )

Unfortunately the map returned from getPathParameters() is not in the format
required by buildFromMap(). It would be good to have a kind of
buildFromMultiMap().

While I'm on it: I'm using a PathParameters class with a getFirst() method.
That's a handy way to access path parameters via Dependency Injection. It
would also be nice to have such a class in JAX-RS, maybe enhanced with
getFirst(name, default).

Regards,

Thomas Koch, http://www.koch.ro