How will i know if it is a chunked since in all cases i get a responce 200 (OK)? Thanks
On Feb 15, 5:37 pm, Daniel Drozdzewski <[email protected]> wrote: > It is worth examining few things about your entity: > > - is it streaming? > - is it chunked? > - get it length.. > > All of those are method calls on HttpEntity. > > Also it is worth checking the headers of your request. If the > requested file is big, it is most likely that it will get chunked by > the web server. In such case, your client will need some extra logic > to receive the whole chunked file. > I *presume* that chunked response mean that getContentLength() returns > the length of each chunk that is ready to be received. > > For more info, read some HTTP 1.1 > spec:http://sharovatov.wordpress.com/2009/04/30/http-chunked-encoding/ > > Daniel > > On 15 February 2012 14:38, limelect <[email protected]> wrote: > > > > > > > > > > > I have this part in a service (or Thread same problem ) to load a file > > greater then 400000 char; > > almost 1/2 a mega char. > > Some times it load much less not consistent. > > How to debug it or make adjustment. > > Same program download jpg (with modifications) of 30k without a > > problem. > > > StringBuilder downloadFile(String url) { > > final int IO_BUFFER_SIZE = 4 * 1024; > > > // AndroidHttpClient is not allowed to be used from the main > > thread > > // final HttpClient client = (mode == Mode.NO_ASYNC_TASK) ? new > > DefaultHttpClient() : > > final HttpClient client = (mode == Mode.CORRECT) ? new > > DefaultHttpClient() : > > AndroidHttpClient.newInstance("Android"); > > final HttpGet getRequest = new HttpGet(url); > > try { > > HttpResponse response = client.execute(getRequest); > > final int statusCode = > > response.getStatusLine().getStatusCode(); > > if (statusCode != HttpStatus.SC_OK) { > > Log.e("WindGraph", "Error " + statusCode + > > " while retrieving file from " + url); > > return null; > > } > > final HttpEntity entity = response.getEntity(); > > BufferedHttpEntity bufHttpEntity = new > > BufferedHttpEntity(entity); > > if (entity != null) { > > InputStream inputStream = null; > > try { > > > inputStream = bufHttpEntity.getContent(); > >>>>>>>>>>>> This is where content fails some time !!!!!!!!!!!!!!!!!!!!!!!!1 > > Log.d("WindGraph","Content size " > > +Integer.toString( (int) bufHttpEntity.getContentLength())); > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Daniel Drozdzewski -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

