Java REST-过滤信息以返回

时间:2018-11-12 13:20:26

标签: java rest

是否存在设计REST服务的设计模式或众所周知的解决方案,其中应用程序的前端可以为对象上的不同信息调用相同的Web服务。

示例:

WebServiceFull.class

@PATH('/car/')
public Response getCarInformation(@PathParam('id') long carId) {
   // Call Service/DAO
   // return the complete Car Object (may contain 50 properties for instance (color, size, age, factory, brand, ....)
}

我想知道是否可行/好:

WebServiceWanted.class
@PATH('/car/')
public Response getCarInformation(@PathParam('id') long carId, @QueryParam('info') List<String> infoWanted) {
   // Call Service/DAO with the List
   // Browse through the given list to only get from DataBase the needed info
   // return the partially complete Car Object
}

0 个答案:

没有答案