Posts

Showing posts from May, 2017

Return Client Specific Response from the Same REST Endpoint in Spring 4

Image
This article is about my research related to the question which I posted on Stackoverflow -  https://stackoverflow.com/questions/44004602/return-client-specific-response-from-the-same-rest-endpoint-in-spring-4 I wanted a way to customize my response from a Spring Rest Controller based on the client which made the request. Client identification can be done via a lot of things, but I had to do it via the scopes. Now, the way I will have to eventually proceed is by creating separate end-points for the clients for unmentionable reasons whatsoever, but I couldn't help myself writing down here so that somebody might just find useful and a better use-case for it. So, here is what I wanted things to work. Let me draw a picture. That would really help to make you understand. Here are the three challenges for me to achieve this: How to get the scope in my code somewhere so that I can do something about it? I needed a way to to intercept/filter the JSON response that was sen