Code example for HttpUriRequest

Methods: abort

0
    protected static byte[] httpBlobResponse(HttpClient httpClient, HttpUriRequest httpRequest) {
        if (httpClient != null) {
            HttpResponse httpResponse;
            HttpEntity entity = null;
            try { 
                httpResponse = httpClient.execute(httpRequest);
                StatusLine statusLine = httpResponse.getStatusLine();
                entity = httpResponse.getEntity();
 
                switch (statusLine.getStatusCode()) {
                    case 200: 
                    case 201: 
                    case 204: 
                        if (entity != null) {
                            return getBlob(new FlushedInputStream(entity.getContent()));
                        } 
                        break; 
                } 
            } catch (ClientProtocolException e) {
                Log.e(TAG, e.toString());
                try { 
                    httpRequest.abort();
                } catch (UnsupportedOperationException ignore) {
                    Log.e(TAG, ignore.toString());
                } 
            } catch (IOException e) {
                Log.e(TAG, e.toString());
                try { 
                    httpRequest.abort();
                } catch (UnsupportedOperationException ignore) {
                    Log.e(TAG, ignore.toString());
                } 
            } finally { 
                if (entity != null) {
Stop searching for code, let great code find you!  Add Codota to your java IDE