title: HTTP request compression
body: <p><strong>General Use-Case</strong></p>
  
  <p>Imagine a client that is uploading large amounts of JSON. The Content-Type should remain <code>application/json</code> because that describes the actual data. Accept-Encoding and Transfer-Encoding seem to be for telling the server how it should format the response. It appears that <em>responses</em> use the Content-Encoding header explicitly for this purpose, but it is not a valid <em>request</em> header.</p>
  
  <p>Is there something I am missing? Has anyone found an elegant solution?</p>
  
  <p><strong>Specific Use-Case</strong></p>
  
  <p>My use-case is that I have a mobile app that is generating large amounts of JSON (and some binary data in some cases but to a lesser extent) and compressing the requests saves a <strong>large</strong> amount of bandwidth. I am using Tomcat as my Servlet container. I am using Spring for it's MVC annotations primarily just to abstract away some of the JEE stuff into a much cleaner, annotation-based interface. I also use Jackson for auto (de)serialization.</p>
  
  <p>I also use nginx, but I am not sure if thats where I want the decompression to take place. The nginx nodes simply balance the requests which are then distributed through the data center. It would be just as nice to keep it compressed until it actually got to the node that was going to process it.</p>
  
  <p>Thanks in advance,</p>
  
  <p>John</p>
  
  <p>EDIT:</p>
  
  <p>The discussion between myself and @DaSourcerer was really helpful for those that are curious about the state of things at the time of writing this.</p>
  
  <p>I ended up implementing a solution of my own. Note that this specifies the branch "ohmage-3.0", but it will soon be merged into the master branch. You might want to check there to see if I have made any updates/fixes.</p>
  
  <p><a href="https://github.com/ohmage/server/blob/ohmage-3.0/src/org/ohmage/servlet/filter/DecompressionFilter.java" rel="noreferrer">https://github.com/ohmage/server/blob/ohmage-3.0/src/org/ohmage/servlet/filter/DecompressionFilter.java</a></p>