I need to send a HTTPPost with body gzipped, the server accepts non gzipped data also but would prefer it gzipped, so Im trying to convert some existing workign code to use gzip The data is currently set with
httpMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs)); Ive tried sublclassing HttpEntityWrapper static class GzipWrapper extends HttpEntityWrapper { public GzipWrapper(HttpEntity wrapped) { super(wrapped); } public void writeTo(OutputStream outstream) throws IOException { GZIPOutputStream gzip = new GZIPOutputStream(outstream); super.writeTo(gzip); } } and added if (!httpMethod.containsHeader("Accept-Encoding")) { httpMethod.addHeader("Accept-Encoding", "gzip"); } but now my request just time outs I think there must be something wrong with my GZIpWrapper but Im not sure what. On another note I looked at the http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientGZipContentCompression.java. example. Aside from the fact that I dont like interceptors because it is difficult to follow program flow it doesnt make sense to me because the request header is set to tell the server to accept gzip data but nowhere does it actually gzip encode any data, it only unzips the response. -- View this message in context: http://old.nabble.com/Problems-trying-to-gziip-a-post-tp31592682p31592682.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org