users@jersey.java.net

[Jersey] Re: UriTemplate to include query string and consider order of its parameters?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Mon, 8 Apr 2013 14:27:14 +0200

On Apr 5, 2013, at 7:06 PM, Martynas Jusevičius <martynas_at_graphity.org> wrote:

> Hey all,
>
> I am using UriTemplate class (mostly the match() method) with URI
> templates that not only include path, but also query string, like this
> one:
>
> /internal/basic_types?limit={limit: [0-9]+}&offset={offset:
> [0-9]+}&accept={mediaType: .+}
>
> It works and does the matching. One problem though: not suprisingly,
> UriTemplate does not consider that the ordering of the query string
> parameters can be arbitrary, and not necessarily exactly the same as
> in the template. For example, the following URI should also match the
> template above:
>
> /internal/basic_types?accept=application%2Fxml&offset=10&limit=20
>
> Is there any code in Jersey (I'm currently using 1.16) that helps to
> solve this issue?

I'm not aware of any such code, unfortunately. Would you mind filing a RFE in our Jira?

Thanks,
Marek

> UriTemplate in .NET seems to handle this case:
> "The query expression, if present, specifies a series of unordered
> name/value pairs delimited by '&'."
> http://msdn.microsoft.com/en-us/library/bb675245.aspx
>
> Martynas
> graphity.org