0

I'd like to modify the response object of type HttpServletResponse, I've implemented the filter which extends OncePerrequestFilter base class.

protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) {
    os = response.getOutputStream();
}

I'd like to get the response as String, modifying it and updating the HttpServletRequest instance content with my modified String. It is possible ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Ashish
  • 1
  • 1
  • Possible duplicate of [Looking for an example for inserting content into the response using a servlet filter](https://stackoverflow.com/questions/14736328/looking-for-an-example-for-inserting-content-into-the-response-using-a-servlet-f) – eHayik Jul 17 '19 at 11:18
  • Nope, I'm trying to use Httpservletresponse and the link you have is using servlertresponse – Ashish Jul 19 '19 at 11:14
  • Here CharResponseWrapper responseWrapper = new CharResponseWrapper( (HttpServletResponse) response); they cast the response to HttpServletResponse, I think the only difference is that you don't need the cast – eHayik Jul 19 '19 at 12:56

0 Answers0