Hi, Currently I am using httpclient's bytearray entity to compress and send data to server. Code for the same is below.
final String url = "www.example.com/u.h"; HttpPost httppost = new HttpPost(url); String data = "Hello World! Blah.. Blah.... Blah.............."; //sample data. this can be huge that the compression helps if (data.length() > AndroidHttpClient.getMinGzipSize(getContentResolver())) { httppost.setHeader("Content-Encoding", "gzip"); } httppost.setEntity(AndroidHttpClient.getCompressedEntity(data.getBytes( "UTF-8"), WorkoutActivity.this.getContentResolver())); HttpResponse response = httpClient.execute(httppost); Now, I want to change the bytearray entity to url encoded entity i.e, I want to change something like "param1=data". i.e, I want to still compress the data and attach it to a http parameter. We use servlet on server side to read the data. Currently with bytestream being uploaded we are using servlet filter to handle decompressing the data. I need the sample code similar to like the one below. String url = "www.example.com/u.z"; HttpPost httppost = new HttpPost(url); String data = "Hello World! Blah.. Blah.... Blah.............."; //sample data. this can be huge that the compression helps List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("param1", data )); // I want the data to be compressed here. httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response= httpclient.execute(httppost); Any help is appreciated. Thanks, Shashidhar -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.