Giter Site home page Giter Site logo

beaver-company / jfilter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rkonovalov/jfilter

0.0 1.0 0.0 735 KB

JFilter. Spring Web Service response filtering

Home Page: https://rkonovalov.github.io/projects/jfilter/1.0.8/

License: Apache License 2.0

Java 100.00%

jfilter's Introduction

License Build Status Maven Central Javadocs codecov Codacy Badge SonarCloud

About

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.

Publications

Publication on medium.com

Publication on dzone.com

Index

Diagram of module flowchart

Diagram

Installation

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>

Getting started

For activation of JFilter module just add next annotations

  • Component scan and enable filter
@ComponentScan({"com.jfilter.components"})
@EnableJsonFilter

Example o usage

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);
    }
  • Service response before filtration
{
  "id": 10,
  "email": "[email protected]", 
  "fullName": "Jane Doe",
  "password": "12345",
  "secretKey": "54321",
  "address": {
    "id": 15,
    "apartmentNumber": 22,
    "street": {
      "id": 155,
      "streetName": "Bourbon Street",
      "streetNumber": 15
    }
  }
}
  • Service response after filtration
{ 
  "email": "[email protected]", 
  "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

Release notes

Version 1.0.8

* 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

Version 1.0.7

* Added FileWatcher controller which auto reloads modified XML Schema based configurations
* Refactored Javadoc
* Fixed incorrect Jackson XML dependency importing

Version 1.0.6

* 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

Version 1.0.5

* Added Filter provider for improving execution speed
* Fixed bugs 

Version 1.0.4

* Added xml Schema-based configuration
* Fixed bugs 

Version 1.0.3

* Added session strategy filtering

Version 1.0.2

* Added additional constructors

Version 1.0.0

* Initial release

jfilter's People

Contributors

rkonovalov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.