Friday, November 30, 2018

Spring Web Service Response Filtering

Introduction

Sometimes, mostly in large projects, there is a need to control the serialization of a service response — especially to filter fields of an object in response. For solving this type of issue, we have several solutions. Let’s take a look.

Issue

For example, we have an object named “User” that contains fields like: id, email, fullName, password, secretKey. We have a task to return this object to a recipient with different fields depending on the role in the session. Also, we have two types of roles: admin and user:



from DZone.com Feed https://ift.tt/2TW9RrP

No comments:

Post a Comment