The javax.ws.rs.core.UriInfo class defines getPathParameters() to return a MultivaluedMap<String,String>, and the javadoc of the interface reads:
Get the values of any embedded URI template parameters.
The "embedded URI template parameters" this is referring to are those defined in javax.ws.rs .Path, where the @Path.value() represents a URI template that contains curly-brace-delimited parameter names, specifying an optional regex pattern to match segments in a URI, or "a default value of [^/]+" is used if no regex is provided.
The URI template is compiled into a regex for the purpose of matching against request URIs.
The "path parameters" that javax.ws.rs.core.UriInfo.getPathParameters() is referring to are constructed during the matching operation between a URI template regex and a request URI. If a match is found, then each of the named groups in the URI template's regex (defined by the curly-brace-delimited parameter names) is dereferenced, and the values are stored in a map.
And so, we come to the map: a MultivaluedMap<String,String>.
From my understanding, and having read the reference implementation of this logic in org.apache.cxf.jaxrs.model.URITemplate, how is it possible that a parameter name could have multiple values?
The only way I can see that this would be possible is if a curly-brace-delimited parameter name is repeated in a @Path.value() -- i.e. something like @Path("{foo}/bar/{foo}").
- Does anyone know where the spec on this subject is specified?
- Is there any other way that a curly-brace-delimited parameter name could have multiple values for a single request URI?
Thank you for your help!