春天相当于泽西岛的SelectableEntityFilteringFeature

时间:2019-05-06 11:42:02

标签: java spring rest jersey jax-rs

我们正在部署带有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无关紧要

0 个答案:

没有答案