1
我怎样才能使用的球衣采用的Restlet尽可能的接受报头字段的版本我们的REST API资源的Restlet版本:使用accept头
// 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, "[email protected]");
}
// Restlet
@GET("json")
public pojo.PersonPoJo test()
{
return new pojo.PersonPoJo("Smith", "Jeff", 34);
}