android-developers
[Arriba] [Todas las Listas]

[no subject]

To: android-developers@xxxxxxxxxxxxxxxx
Subject:
From: Shashidhar <shashi.zephyr@xxxxxxxxx>
Date: Mon, 29 Sep 2014 15:13:50 +0530
Delivery-date: Mon, 29 Sep 2014 05:46:41 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:date:message-id:subject:from:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=KmnQprl4qPbm+A1HoZZY/FkK2yzYw+Sf1YzJeXeTfag=; b=AL0ow4wcjF44Bbo1nYXuASEjZkc3fcj0KbiN0Ds8iAaBSWsaDxvTOvjsyS4Keaac1t COfejC7mswPuFqCNG0wId2rNqazfSgJmDBNy9OpAS6nLrnUZEpFUznMOqPGBycVXVS1Y 8Ic4XmuOL5F8VL4q7rIb3ZLQjk1h/guPCbsWdgQxRKbyn8whhVg243IBXO3OE2btz9FS kWcYj9VhWNQktknfMWCh3YPsm3rjJebD5sCG1vFswC2S569FIJUs5/ex4lFjrngatR93 +R3eWms77gJqZpy44SnyAbEmDit3go+emUNFj563LMOMEhQhs4+ISB3y+UlYBVMmeOZM Cvdg==
Envelope-to: traductor@xxxxxxxxxxx
List-archive: <http://groups.google.com/group/android-developer>
List-help: <http://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>, <http://groups.google.com/group/android-developers/subscribe>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
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+unsubscribe@xxxxxxxxxxxxxxxx.
For more options, visit https://groups.google.com/d/optout.
<Anterior por Tema] Tema Actual [Siguiente por Tema>
  • [no subject], Shashidhar <=