Code example for HttpResponse

Methods: getEntitygetStatusLine

0
            mGetComplete = false;
            HttpGet httpRequest = new HttpGet(mUrl.toString());
            ResponseHandler<byte[]> handler = new ResponseHandler<byte[]>() {
                @Override 
                public byte[] handleResponse(HttpResponse response) throws IOException {
                    if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                        return null; 
                    } 
                    HttpEntity entity = response.getEntity();
                    return (entity == null ? null : EntityUtils.toByteArray(entity));
                } 
            }; 
 
            mBytes = null;
            try { 
                /** 
                 * TODO: Not exactly sure why some requests hang indefinitely, but adding this 
                 * timeout (in static getter for http client) in loop helps. 
                 */ 
                boolean timedOut;
                do {