I have implemented Versionning as below. Currently I am Implementing it like this manner
@GET
@Path("/{id}")
@Produces("application/v1+json;version=1")
public TrackV1 getV1(@PathParam("id") int id) String version) {
return new TrackV1("Version=1", "Version=1", "2:30", 1941);
}
@GET
@Path("/{id}")
@Produces("application/v2+json;version=2")
public TrackV1 getVa1(@PathParam("id") int id) {
return new TrackV1("Version=2", "Version=2", "2:30", 2941);
}
But I need to change it into following Implementation :-
@GET
@Path("/{id}")
@Produces("application/json;version=1")
public TrackV1 getV1(@PathParam("id") int id) String version) {
return new TrackV1("Version=1", "Version=1", "2:30", 1941);
}
@GET
@Path("/{id}")
@Produces("application/json;version=2")
public TrackV1 getVa1(@PathParam("id") int id) {
return new TrackV1("Version=2", "Version=2", "2:30", 2941);
}
So any help how to implement in Spring or Jax-Rs and Jersey.