我们正在部署带有jersey终结点的Spring应用程序,
我们可以通过添加SelectableEntityFilteringFeature
在Jersey中过滤JSON响应用于添加对自定义查询参数过滤的支持 实体数据过滤功能
春天相当于泽西岛的SelectableEntityFilteringFeature?
使用查询参数的过滤器用法示例:
命中HTTP GET:http://localhost:8080/JerseyDemos/rest/employees 响应:
{"employeeList":[ {"id":1,"name":"Lokesh Gupta"}, {"id":2,"name":"Alex Kolenchiskey"}, {"id":3,"name":"David Kameron"}]}
命中HTTP GET:http://localhost:8080/JerseyDemos/rest/employees?select=employeeList,id 响应:
{"employeeList":[{"id":1},{"id":2},{"id":3}]}
命中HTTP GET:http://localhost:8080/JerseyDemos/rest/employees/1 响应:
{"id":1,"name":"Lokesh Gupta"}
命中HTTP GET:http://localhost:8080/JerseyDemos/rest/employees/1?select=id 响应:
{"id":1}
使用Spring的@RestController
时,如何在没有球衣的情况下过滤响应数据?
我们没有使用Hibernate / JPA,因此Hibernate solution无关紧要