'modify Response Object returbed by an endpoint
I have an endpoint method that returns a List of Items, I wonder how can I intercept this list to apply some modifications for example:
@PostMapping(value="/someUrl")
public List<Items> find(@RequestBody Command cmd){
//do something
return arrayListOfItems;
}
I tried to do using HandlerInterceptor, is it possible to get the returned list from the HttpServletResponse here?, if not what is the best solution ?
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object o, ModelAndView modelAndView) throws IOException {
//how can I get the returned List<Items> and modify it here, before returning it to the client
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
