【发布时间】:2016-03-03 12:52:48
【问题描述】:
如何在 jersey 中尽可能使用 restlet 的接受头字段对我们的 REST api 进行版本控制:
// Jersey
@GET
@Path("test")
@Produces("application/myapp.v1+json;charset=utf-8")
public pojo.v1.PersonPoJo testV1()
{
return new pojo.v1.PersonPoJo("Smith", "Jeff", 34);
}
@GET
@Path("test")
@Produces("application/myapp.v2+json;charset=utf-8")
public pojo.v2.PersonPoJo testV2()
{
return new pojo.v2.PersonPoJo("Smith", "Jeff", 34, "j.smith@rest.com");
}
// Restlet
@GET("json")
public pojo.PersonPoJo test()
{
return new pojo.PersonPoJo("Smith", "Jeff", 34);
}
【问题讨论】:
标签: jersey versioning restlet