【发布时间】:2020-11-18 03:42:11
【问题描述】:
我有两个 get API 具有相同的请求、路径和响应,其中一个已经存在,另一个是新创建的。
@GET
@Path("/{id}/export")
public Response exportVersion1(@PathParam("id") String id, @QueryParam("format") final String format)
@GET
@Path("/{id}/export")
@Consumes({"application/vnd.com.abc.v2+json"})
public Response exportVersion2(@PathParam("id") String id, @QueryParam("format") final String format)
在将内容类型指定为 application/vnd.com.abc.v2+json 时,我可以调用第二个 API,但如果没有指定内容类型,那么也会调用第二个 API。
我想将第一个设为默认值,并且不想更改/添加它,因为它绑定到客户端使用的 UI。我只能对第二个API进行更改,请提出任何建议。
【问题讨论】:
标签: java spring rest web-services model-view-controller