@Override public Boolean handleResponse(HttpResponse response) throws IOException { try { if (200 != response.getStatusLine().getStatusCode()) { handleErrorResponse(response, httpGet); return false; } else {//success logger.debug("check lookout gateway ok.{}", httpGet.toString()); } } finally { EntityUtils.consumeQuietly(response.getEntity()); } return true; } });
Log.d("httpGet", httpGet.toString()); HttpResponse httpResponse = httpClient.execute(httpGet); Log.d("httpResponse", httpResponse.toString());
new Timer(true).schedule(task, hardTimeout * 1000); log.debug("Executing HTTP request: {}",request.toString()); httpResponse = (CloseableHttpResponse)httpClient.execute(request,httpClientContext);
public HttpResponse get(String uri, List<BasicNameValuePair> parameters, boolean signatureRequired) throws BitPayException { try { String fullURL = _baseUrl + uri; HttpGet get = new HttpGet(fullURL); if (parameters != null) { fullURL += "?" + URLEncodedUtils.format(parameters, "UTF-8"); get.setURI(new URI(fullURL)); } if (signatureRequired) { get.addHeader("x-signature", KeyUtils.sign(_ecKey, fullURL)); get.addHeader("x-identity", KeyUtils.bytesToHex(_ecKey.getPubKey())); } get.addHeader("x-bitpay-plugin-info", BITPAY_PLUGIN_INFO); get.addHeader("x-accept-version", BITPAY_API_VERSION); _log.info(get.toString()); return _httpClient.execute(get); } catch (URISyntaxException e) { throw new BitPayException("Error: GET failed\n" + e.getMessage()); } catch (ClientProtocolException e) { throw new BitPayException("Error: GET failed\n" + e.getMessage()); } catch (IOException e) { throw new BitPayException("Error: GET failed\n" + e.getMessage()); } }
request.setHeader("Accept", MediaType.APPLICATION_JSON.getMediaType()); try { out.println(request.toString()); CloseableHttpResponse response = client.execute(request);
request.setHeader("Accept", MediaType.APPLICATION_JSON.getMediaType()); try { out.println(request.toString()); try(CloseableHttpResponse response = client.execute(request)) {
httpGet.addHeader(header.getKey(), header.getValue()); log.debug(httpGet.toString()); StringBuilder h = new StringBuilder(httpGet.toString()); for (Map.Entry<String, String> header :headers.entrySet()) h.append(Utility.nl).append(header.getKey()).append(" ") testLog.add_name_value(requestE, "Request", httpGet.toString()); OMElement headerE = testLog.add_simple_element(requestE, "Headers"); for (Map.Entry<String, String> header :headers.entrySet())
Log.info("QUERY EDIT TOKEN: ", httpGet.toString()); String editToken = httpClient.execute(httpGet, extractEditToken());