Doh!
getFirst works just fine for defaffing the MultivaluedMap.
Jim
On 06/07/2010 07:51, Jim Talbut wrote:
I don't think I worded my question very well, this is what I want to do:
URITemplate userGroupUriTemplate = URITemplate.createTemplate(
"/project/{projectName}/group/{groupName}" );
URI relativeUri = baseUri.relativize( targetUri );
MultivaluedMap< String, String > map = new MetadataMap< String,
String >();
boolean matches = userGroupUriTemplate.match( "/" +
relativeUri.toString(), map );
So that given targetUri =
"http://localhost:8822/rest/project/Ringo/group/Drummers" I can get
project: Ringo and group: Drummers.
I don't know if there is a better way than that, but that does work.
I'd like
a ) to be able to define the path based on class and method (like I
can with a UriBuilder), to avoid a duplication.
b) to get a single valued map, to avoid faffing with unnecessary (for
me) Lists.
Any improvements?
Thanks.
Jim
On 04/07/2010 21:02, Sergey Beryozkin wrote:
Hi
You can do URIBuilder.fromURI(stringURIvalue).build() which will
return URI
and then you can check the components
cheers, Sergey
On Sun, Jul 4, 2010 at 7:49 AM, Jim Talbut<[email protected]>
wrote:
Hi,
I have a method that receives a collection of objects, each of which
has a
unique URI as a member, and I need to parse these URI into their
component
parts.
Clearly these URIs are not the URI of the method that is currently
running,
which seems to mean that UriInfo isn't any help.
Are there any JAX-RS ways to parse a URI based upon a specific
method (like
an anti-UriBuilder), or am I on my own?
Thanks
Jim