/** * This method can be used to validate the response, the default implementation check * that the status code is 200. * @param response the responce to check * @return true if it's a valid response */ public boolean validateResponse(HttpResponse response) { if (response.getStatusLine().getStatusCode() != 200) { log(Level.ERROR, "Connection to %s fail with %s", getUrl(), response.getStatusLine().getReasonPhrase()); return false; } return true; }
HttpEntity entity = null; try { HttpRequestBase hg = new HttpGet(getUrl().toURI()); if (! changeRequest(hg)) { return Collections.emptyMap(); log(Level.ERROR, "Not response body to %s", getUrl()); return Collections.emptyMap(); return vars; } catch (IllegalStateException | IOException e) { log(Level.ERROR, e, "Unable to read %s because: %s", getUrl(), e.getMessage()); } catch (URISyntaxException e) { log(Level.ERROR, "unable to parse %s", getUrl()); } finally { if(entity != null) {