title: How change the response in HandlerInterceptorAdapter in SpringBoot?
body: <p>I have a backend written in Java (SpringBoot) which sends the response to the frontend. I am working with too many data in json, so I decided to compress it using GZIP for a quicker transaction, but I have found several errors in the code, due to I don't know very well how to deal with some classes.</p>
  
  <p>I use the postHandle() method with the code above (which I found in stackoverflow in other question):</p>
  
  <pre><code>    @Override
      public void postHandle(
          HttpServletRequest request,
          HttpServletResponse response,
          Object handler,
          ModelAndView modelAndView) throws Exception {
  
        ByteArrayOutputStream obj=new ByteArrayOutputStream();
        GZIPOutputStream gzip = new GZIPOutputStream(obj);
        gzip.write(request.getBytes("UTF-8"));
        gzip.close();
      }
  </code></pre>
  
  <p>The problem is that my request has not a getBytes() method, so it couldn't be done.</p>
  
  <p>Any idea of how I can do it? I need to compress every data is send from backend to frontend.</p>
  
  <p>Thank you in advance!</p>