I went through all good discussion on api versioning here. We decided to put the version number in the URI, for this we now have to support, clients requesting resource without api version in the uri , to the latest version, by default. example:
http://base_uri/api/customers/1234 (with out api version)
http://base_uri/api/v3.0/customers/1234 (default to current version)
Step 1 :To address above: I am thinking of URL rewrite using(url rewrite, jboss valve) please advise if there are any better approaches.
Step 2: Now i need to pre-pend all the @Path annotations with my version number "v1".
@Path("/foo/bar") will now change to @Path("v1/foo/bar").
I was thinking of having a place holder in place of version
ex: @Path("{version}/foo/bar")
and read the version name from a configuration file, while rest-easy is scanning resources and registering. So in future if we move to new version, all we need is to change in one place.
I am looking for best approaches in step1 & step2. any help is greatly appreciated.
I am using Rest-easy,jax-rs 2.0,jboss