Code example for HttpUriRequest

Methods: abort

0
     */ 
    private static HttpResponse safelyExecute(HttpClient client, HttpUriRequest request)
            throws IOException { 
        HttpResponse resp = null;
        try { 
            resp = client.execute(request);
        } catch (IOException e) {
            closeResources(request, resp);
            throw e;
        } 
         
        return resp;
    } 
     
    private static void closeResources(HttpUriRequest req, HttpResponse resp) {
        try { 
            req.abort();
        } catch (UnsupportedOperationException ignore) {
        } 
        final HttpEntity entity = resp != null ? resp.getEntity() : null;
        if (entity != null) {
            try { 
Contextual code suggestions in your IDE  Get Codota for Java