2014-10-07 19:19 GMT+02:00 Duncan Keysell (dkeysell) <[email protected]>:
> Hi,
>
> I have the requirement to support versioning on my REST API in a legacy
> application I have inherited. I have to implement the versioning of the
> resources via a version segment of the URL, as that is what we have
> advertised we are doing. e.g. /myRoot/v1/myResource and
> /myRoot/v2/myResource. Currently my REST API has the following config (I.e.
> Everything is hardcoded to appear at v1):
>
> <jaxrs:server id="myService" address="/v1" name="myService">
> …
> </jaxrs:server>
>
> I have updated by serviceBeans so that they now expect to receive the
> /v[0-9]+ segment as a path parameter:
>
>
> @Path("/{version:v[0-9]+}/myResource")
>
>
> And for that to work I have to move my jaxrs:server to the address="/"
>
>
> However I have found there is already another jaxrs:server with address="/"
>
>
> I don't want to mix my serviceBean with the one already sitting on "/" as
> both of us have interceptors and providers not suitable to each other. Also
> I don't want to change the URLs of any of the resources as this will break
> clients..
>
>
> Is there any solution to this dilemma?
>
Hi
I have no idea , because I guess that you cannot configure two different
endpoints with the same address.
Maybe you could implement some kind of url rewriting: eg , you deploy your
new endpoint in /versions/
If you receive a request with http://www.example.com/myRoot/v1/myResource ,
it's rewrited to http://www.example.com/myRoot/versions/v1/myResource
How ?
Maybe with an Apache frontend (mod_rewrite)
Maybe some ingoing message interceptor/filter/whatever , executed in the
right order into the chain
I'm not sure. I hope this helps you
Regards
>
>
> Thanks
>
> Duncan
>