Jersey Selectable EntityFilteringFeature Example - HowToDoInJava
Often times, you want to make RESTful API consumers capable of filtering data what they need from a GET API, rather than forcing them to consume all the response data unnecessary. There are two ways to achieve this filtering : server side response filtering and client side response filtering. Server side response filtering, though useful, requires you to change API sourcecode and configuration – but enabling client side response filtering does not require API level changes. It's easy to implement and easier to use.
To demonstrate the use of client side response filtering using SelectableEntityFilteringFeature
, I am using the sourcecode created for Jersey 2 Hello World Example.
Registering SelectableEntityFilteringFeature in Jersey
All you need to do is – register SelectableEntityFilteringFeature
in ResourceConfig
class in this way:
Read full article from Jersey Selectable EntityFilteringFeature Example - HowToDoInJava
No comments:
Post a Comment