Note that there are some explanatory texts on larger screens.

plurals
  1. POHTTP gzip encoding with multipart message
    text
    copied!<p>I am trying to send a <code>gzip</code>ed multipart <code>POST</code> to a Tomcat server from a Java application using Jersey. When the multipart request is not compressed, it works perfectly fine. Other types of compressed POSTS work fine, such as sending a single entity XML. I (believe) posting compressed data isn't an HTTP standard, but it does seem Tomcat supports it to some degree.</p> <p>a working uncompressed multipart post:</p> <pre><code>POST /myApp/rest/data HTTP/1.1 Content-Type: multipart/mixed; boundary=Boundary_1_23237284_1331130438482 Cookie: JSESSIONID=XXXXXXXXXXXXXXXXXXXXXXXXX;Version=1;Path=/myApp/ MIME-Version: 1.0 User-Agent: Java/1.6.0_26 Host: localhost:8080 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive Transfer-Encoding: chunked d3 --Boundary_1_23237284_1331130438482 Content-Type: application/octet-stream Content-Disposition: form-data; filename="uploadFile.war"; modification-date="Wed, 29 Feb 2012 18:01:38 GMT"; size=25343899; name="file" {binary data here} --Boundary_1_25179713_1331128929019 Content-Type: application/xml &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;myXMLEntity&gt;stuff&lt;/myXMLEntity&gt; --Boundary_1_25179713_1331128929019-- </code></pre> <p>When I compress it using the Jersey <code>GZIPContentEncodingFilter()</code> the following headers are sent, and I get back an HTTP 400 with a description of "incorrect syntax"</p> <pre><code>POST /myApp/rest/data HTTP/1.1 Content-Type: multipart/mixed Cookie: JSESSIONID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;Version=1;Path=/myApp/ Accept-Encoding: gzip Content-Encoding: gzip User-Agent: Java/1.6.0_26 Host: localhost:8080 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive Transfer-Encoding: chunked {binary data here} </code></pre> <p>Is what I'm trying to do possible? Should the <code>Content-Type</code> actually read <code>multipart/x-gzip</code>? I notice that when it gets compressed, the boundary text gets left off of the <code>Content-Type</code> header - is this also a problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload