Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpUriRequest.abort()


        HttpContext ctx = new BasicHttpContext();

        HttpUriRequest req = new HttpGet("http://www.hooktheory.com/analysis/view/the-beatles/i-want-to-hold-your-hand");
        client.execute(req, ctx);
        req.abort();

        List<String> urls = getSongUrls("http://www.hooktheory.com/analysis/browseSearch?sQuery=&sOrderBy=views&nResultsPerPage=525&nPage=1", client, ctx);
        List<List<? extends NameValuePair>> paramsList = new ArrayList<>(urls.size());
        for (String songUrl : urls) {
            paramsList.addAll(getSongParams(songUrl, client, ctx));
View Full Code Here


    private static String getResponseAsString(String urlString, HttpClient client, HttpContext ctx) throws IOException {
        HttpUriRequest req = new HttpGet(urlString);
        InputStream is = client.execute(req, ctx).getEntity().getContent();
        String result = CharStreams.toString(new InputStreamReader(is));
        is.close();
        req.abort();
        return result;
    }
}
View Full Code Here

      throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, e,
          HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    } finally {
      // cleanup any outstanding resources..
      if (httpMethod != null) try {
        httpMethod.abort();
      } catch (UnsupportedOperationException e) {
        // ignore
      }
    }
  }
View Full Code Here

            // 1xx. HTTP/1.1 extensions
            else if (statusCode >= HttpStatus.SC_CONTINUE) {
                throw new IllegalStateException(String.format("Unexpected status code: %d received.", statusCode));
            }
        } catch (IOException io) {
            httpRequest.abort();
            throw new ServiceException("client side error", io);
        } finally {
            if (httpResponse != null) {
                // consume all entity part so that the connection will be close.
                HttpEntity httpEntity = httpResponse.getEntity();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.