AFAIK jersey doesn't do request routing on query parameters. A couple
of options:
1. If you're flexible with your API, you can make the version number a
prefix of the path. Then its a simple matter of having a different
root resource registered for each version of your API.
2. If your API is not flexible, then you'll have to do the heavy
lifting. Your root resource(s) methods will have to accept the
QueryParam argument, check its value, and return the version-specific
Resource class as a "subresource". Even though this is a bit of an
abuse of that mechanic, it should achieve the result. But its a lot
more work than option 1.
HTH,
Christopher
On 7/2/11, Umesh Bhatt <umesh_bhatt_at_mindtree.com> wrote:
> Hi,
>
> I want to add version support in my rest web service and want to achieve as
> mentioned below. Please let me know how to achieve it.
>
> In URL I want to add QueryParam version and based on this value want to call
> correct resource. For this I want to create Http request interceptor to
> check version info and call appropriate resource.
> Please let me know how to do this.
>
> Thanks,
> Umesh
>
> ________________________________
>
> http://www.mindtree.com/email/disclaimer.html
>