jfilter一个方便的spring rest 响应过滤扩展

jfilter 技术上是利用了ControllerAdvice以及ResponseBodyAdvice 在beforeBodyWrite中进行响应内容的处理
jfilter利用了自定义注解技术,同时官方文档还是比较全的,值得学习下

参考处理流程

 

 

说明

实际上jersey 也提供了类似的能力(filter),功能上相比spring 的更加方便点ContainerResponseFilter, 提供open-metadata 对于es &事件处理&审计处理就是利用了
此能力,实现的功能很方便而且也很强大,此中设计模式是一个是值得参考的

参考资料

https://github.com/rkonovalov/jfilter
https://rkonovalov.github.io/projects/jfilter/1.0.17/
https://dzone.com/articles/spring-web-service-response-filtering
https://www.baeldung.com/jersey-filters-interceptors
https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/filters-and-interceptors.html

posted on 2021-11-28 23:21  荣锋亮  阅读(130)  评论(0编辑  收藏  举报

导航