title: How to gzip ajax requests with Struts 2?
body: <p>How to gzip an ajax response with Struts2? I tried to create a filter but it didn't work. At client-side I'm using jQuery and the ajax response I'm expecting is in json.</p>
  
  <p>This is the code I used on server:</p>
  
  <pre><code>    ByteArrayOutputStream out = new ByteArrayOutputStream();
      GZIPOutputStream gz = new GZIPOutputStream(out);
      gz.write(json.getBytes());
      gz.close();
  </code></pre>
  
  <p>I'm redirecting the response to dummy jsp page defined at struts.xml.</p>
  
  <p>The reason why I want to gzip the data back is because there's a situation where I must send a relatively big sized json back to the client.</p>
  
  <p>Any reference provided will be appreciated.</p>
  
  <p>Thanks.</p>