jfilter Code
JFilter module will help you to filter response of Web Service
Brought to you by:
rkonovalov
File | Date | Author | Commit |
---|---|---|---|
.circleci | 2018-11-06 |
![]() |
[5e05d6] Changed Circle CI config |
.idea | 2018-11-10 |
![]() |
[63a14b] Refactored tests |
src | 2018-11-11 |
![]() |
[9e8d0f] Removed unused field |
.travis.yml | 2018-11-08 |
![]() |
[6a533c] Changed Travis CI config |
LICENSE | 2018-10-14 |
![]() |
[7a0e1c] Added license |
README.md | 2018-11-14 |
![]() |
[4250ea] Removed Google Analytics |
codecov.yml | 2018-11-10 |
![]() |
[8349fa] Changed codecov |
jsonignore.iml | 2018-10-13 |
![]() |
[e65a09] Deployment of 1.0.0 version to Maven central |
pom.xml | 2018-11-11 |
![]() |
[c12f50] Version changed from 1.0.7 to 1.0.8 |
sonar-project.properties | 2018-11-11 |
![]() |
[d214f0] Refactored properties |
This module could be used in Spring Web Service project for filter(exclude) of fields in Service response.
When you used Jackson @JsonView interface and need more powerful and flexibility, this module could be useful.
For information please follow the links below.
For using this module you need to import dependency
<dependency>
<groupId>com.github.rkonovalov</groupId>
<artifactId>json-ignore</artifactId>
<version>1.0.8</version>
</dependency>
For activation of JFilter module just add next annotations
@ComponentScan({"com.jfilter.components"})
@EnableJsonFilter
This example illustrates how easy you can configure Service Response.
Just add FieldFilterSetting annotation with filterable fields and module will exclude them from response
@FieldFilterSetting(className = User.class, fields = {"id", "password", "secretKey"})
@RequestMapping(value = "/users/signIn",
params = {"email", "password"}, method = RequestMethod.POST,
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
produces = {MediaType.APPLICATION_JSON_VALUE})
public User signIn(@RequestParam("email") String email, @RequestParam("password") String password) {
return userController.signInUser(email, password);
}
{
"id": 10,
"email": "janedoe@gmail.com",
"fullName": "Jane Doe",
"password": "12345",
"secretKey": "54321",
"address": {
"id": 15,
"apartmentNumber": 22,
"street": {
"id": 155,
"streetName": "Bourbon Street",
"streetNumber": 15
}
}
}
{
"email": "janedoe@gmail.com",
"fullName": "Jane Doe",
"address": {
"id": 15,
"apartmentNumber": 22,
"street": {
"id": 155,
"streetName": "Bourbon Street",
"streetNumber": 15
}
}
}
For more examples please follow to the link Examples
* Added Dynamic Filter which allows to create own filters with custom behaviour
* Added DynamicSessionFilter for storing custom field filter in session
* Added feature for auto loading XML Schema-based configuration filter when it changed on runtime
* Changed package name from com.json.ignore to com.jfilter
* Changed package from advice to components
* Fixed bug in FileFilter which not allowed to load xml configuration from external source
* Added FileWatcher controller which auto reloads modified XML Schema based configurations
* Refactored Javadoc
* Fixed incorrect Jackson XML dependency importing
* Added JSON/XML converters inherited from HttpMessageConverter
* Removed native reflection and added Jackson BeanSerializerModifier for field filtering
* Added EnableJsonFilter annotation for enabling/disabling filtration
* Added ability to apply filter annotations on whole Spring Rest controller
* Fixed bugs
* Added Filter provider for improving execution speed
* Fixed bugs
* Added xml Schema-based configuration
* Fixed bugs
* Added session strategy filtering
* Added additional constructors
* Initial release