Why can't my HttpPost receive all response data?

I'm on Android 1.5 and my code looks like this:

HttpPost httpPost = new HttpPost(url);
HttpEntity entity = new UrlEncodedFormEntity(params, HTTP.UTF_8);
httpPost.setEntity(entity);

HttpResponse response = httpClient.execute(httpPost);
HttpEntity respEntity = response.getEntity();
String result = EntityUtils.toString(respEntity, DEFAULT_CHARSET);

      

Upon successful execution of these codes, the result is a stripped string. I tried using browser to check url + param, it works fine and got all data.

What's wrong with this code? Are there any parameters I need to specify?

+2


a source to share


2 answers


Try using ResponseHandler

pattern
and see if it gives you better results.



+1


a source


It works:



HttpResponse response = httpclient.execute (httppost);
BufferedReader reader = new BufferedReader (new InputStreamReader (response.getEntity (). GetContent ()));
0


a source







All Articles