public String getStatusText() { return delegateResponse.getStatusText(); }
public void handle(final Response createLinkBackResponse) throws ResponseException { if (createLinkBackResponse.getStatusCode() == 201) { // cool! created reciprocal link, continue } else { throw new ResponseException(String.format("Received %s - %s", createLinkBackResponse.getStatusCode(), createLinkBackResponse.getStatusText() )); } } });
public Boolean handle(final Response response) throws ResponseException { if (response.getStatusCode() == 200) { // deleted reciprocal link, continue return false; } else { throw new ResponseException(String.format("Received %s - %s", response.getStatusCode(), response.getStatusText() )); } }
public void handle(final Response response) throws ResponseException { if (response.getStatusCode() == 200) { // deleted reciprocal link, continue } else { throw new ResponseException(String.format("Received %s - %s", response.getStatusCode(), response.getStatusText() )); } } });
public RestResponse(Response response) { statusCode = response.getStatusCode(); statusMessage = response.getStatusText(); successful = response.isSuccessful(); try { responseBody = IOUtils.toString(response.getResponseBodyAsStream(), "UTF-8"); json = new JSONObject(responseBody); } catch (JSONException e) { json = null; errors.add("Failed to parse server response as JSON: " + e.getMessage()); } catch (Throwable e) { errors.add("Failed to retrieve the response from Jenkins: " + e.getMessage()); } }
/** * Constructor * * @param response the Response to get the data from */ public RestResponse(Response response) { statusCode = response.getStatusCode(); statusMessage = response.getStatusText(); headers = response.getHeaders(); successful = response.isSuccessful(); try { responseBody = IOUtils.toString(response.getResponseBodyAsStream()); json = new JSONObject(responseBody); } catch (JSONException e) { json = null; // Ignoring this, probably not needed for the request that was send } catch (Throwable e) { errors.add("Failed to retrieve the response from SonarQube: " + e.getMessage()); } }
public Document handle(Response response) throws ResponseException { log(response); alreadyTriedURLs.add(nextTryURL.get()); if (!response.isSuccessful()) { throw new ResponseException(String.format("Received status code %d (%s)", response.getStatusCode(), response.getStatusText())); } // update the redirect info if (REDIRECT_STATUS_CODES.contains(response.getStatusCode())) { String location = response.getHeader("location"); if (location == null) { throw new ResponseException(String.format("Received status code %d (%s) but no location was specified", response.getStatusCode(), response.getStatusText())); } nextTryURL.set(location); return null; } return extractDocumentFrom(response); }
public void handle(final Response response) throws ResponseException { if (response.getStatusCode() == 200) { Iterables.addAll(entities, response.getEntity(ReferenceEntityList.class).getEntities(typeAccessor)); } else { throw new ResponseException(String.format("Failed to retrieve entity list, received %s response: %s", response.getStatusCode(), response.getStatusText())); } } });
@Override public void handle(Response response) throws ResponseException { if (!response.isSuccessful()) { throw new ResponseException("Registration failed, received " + response.getStatusCode() + " " + response.getStatusText() + " from peer."); } } });
public Document handle(Response response) throws ResponseException { log(response); alreadyTriedURLs.add(nextTryURL.get()); if (!response.isSuccessful()) { throw new ResponseException(String.format("Received status code %d (%s)", response.getStatusCode(), response.getStatusText())); } // update the redirect info if (REDIRECT_STATUS_CODES.contains(response.getStatusCode())) { String location = response.getHeader("location"); if (location == null) { throw new ResponseException(String.format("Received status code %d (%s) but no location was specified", response.getStatusCode(), response.getStatusText())); } nextTryURL.set(location); return null; } return extractDocumentFrom(response); }
public void handle(Response response) throws ResponseException { int statusCode = response.getStatusCode(); if (statusCode == HttpServletResponse.SC_UNAUTHORIZED || statusCode == HttpServletResponse.SC_FORBIDDEN) addFieldError("password", getText("editinstances.errors.authentication")); else if (statusCode != HttpServletResponse.SC_OK) { log.error("Unknown error. Status: " + response.getStatusText() + " (" + statusCode + ")"); addFieldError("url", getText("editinstances.errors.connection")); } } };
public Void handle(final Response response) throws ResponseException { if (response.isSuccessful()) { final String body = response.getResponseBodyAsString(); if (body == null || "".equals(body)) { status.set(AuthenticationStatus.ANONYMOUS); } else { username.set(body); status.set(AuthenticationStatus.ACCEPTED); } } else { status.set(AuthenticationStatus.COMMUNICATION_ERROR); errorMessage.set(String.format("%s: %s", response.getStatusCode(), response.getStatusText())); } return null; }
public void handle(final Response response) throws ResponseException { final int statusCode = response.getStatusCode(); if (statusCode == HttpServletResponse.SC_UNAUTHORIZED || statusCode == HttpServletResponse.SC_FORBIDDEN) addError("magicFisheyePassword", getText("editinstances.errors.fisheye.password.incorrect")); else if (statusCode == HttpServletResponse.SC_NOT_FOUND) addError("magicFisheyePassword", getText("editinstances.errors.fisheye.not.recognised")); else if (statusCode != HttpServletResponse.SC_OK) { log.info("Unknown error checking FishEye admin password. Status: " + response.getStatusText() + " (" + statusCode + ")"); addError("url", getText("editinstances.errors.connection")); } } };
problems.add(new IntegrationProblem(stashLink, i18n().getText("stash.integration.problem.error.message", String.valueOf(response.getStatusCode()), response.getStatusText())));
public T handle(Response response) { try { HttpResponse coreResponse = new HttpResponse(response.getStatusCode(), response.getStatusText(), response.getHeaders(), response.getResponseBodyAsStream()); return responseProcessor.process(coreResponse); } catch (IOException | ResponseException e) { throw new StashException(e); } } }
public void handle(Response response) throws ResponseException { if (!response.isSuccessful()) { addErrorMessage(getText("crucible.admin.error.status.code", Integer.toString( response.getStatusCode()), response.getStatusText())); } else { try { CrucibleProjectConfig config = (CrucibleProjectConfig) XStreamUtils.fromXML( response.getResponseBodyAsString()); setProjectConfig(config); } catch (RuntimeException re) { addErrorMessage(getText("crucible.admin.error.deserialisation")); log.error("Error deserialising crucible admin response", re); } } } });
public Object handle(Response resp) throws ResponseException { try { if("ERROR".equals(resp.getHeader("X-Seraph-Trusted-App-Status"))) { String taError = resp.getHeader("X-Seraph-Trusted-App-Error"); throw new TrustedAppsException(taError); } checkForErrors(resp.isSuccessful(), resp.getStatusCode(), resp.getStatusText()); responseHandler.handleJiraResponse(resp.getResponseBodyAsStream(), null); } catch (IOException e) { throw new ResponseException(e); } return null; }
public RestResponse handle(final Response response) throws ResponseException { ErrorCollection errors = null; if (!response.isSuccessful()) { // Check if the response contains an ErrorCollection try { final String responseString = ResponseUtil.getResponseAsTrimmedString(response); final JSONObject json = new JSONObject(new JSONTokener(responseString)); errors = convertJsonToErrorCollection(json); } catch (final JSONException e) { // Response did not contain an ErrorCollection errors = null; } } return new RestResponse(errors, response.getStatusCode(), response.getStatusText(), response.isSuccessful()); } }
public JiraRestResponse handle(Response response) JiraRestResponse.JiraRestResponseBuilder respBuilder = new JiraRestResponse.JiraRestResponseBuilder(response.getStatusCode(), response.getStatusText()); if (!response.isSuccessful())