public ApplicationStatus handle(final Response response) throws ResponseException { return response.isSuccessful() ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE; } });
public Boolean handle(final Response restResponse) throws ResponseException { return restResponse.isSuccessful(); } });
public boolean isSuccessful() { return delegateResponse.isSuccessful(); }
public void handle(final Response response) throws ResponseException { assertTrue(response.isSuccessful()); } });
public void handle(final Response response) throws ResponseException { assertTrue(response.isSuccessful()); } });
public ErrorListEntity handle(final Response response) throws ResponseException { // 201 means we created a new application link. // 200 means there already is an application link and we just updated this one. return !response.isSuccessful() ? response.getEntity(ErrorListEntity.class) : null; } });
public void handle(final Response restResponse) throws ResponseException { if (restResponse.isSuccessful()) { rpcUrlValid.set(true); } } });
@Override public ApplicationStatus handle(final Response response) throws ResponseException { return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE; }
public void handle(final Response response) throws ResponseException { if (!response.isSuccessful()) { log.error("Error calling " + request + ". Response: " + response.getResponseBodyAsString()); returnValue.set(false); } else { returnValue.set(true); } } };
@Override public ApplicationStatus handle(final Response response) throws ResponseException { return response.isSuccessful() || (response.getStatusCode() == HttpStatus.SC_FORBIDDEN) || (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE; }
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()); } }
public String handle(final Response response) throws ResponseException { if (!response.isSuccessful()) { throw new ResponseStatusException("Unexpected response received. Status code: " + response.getStatusCode(), response); } return response.getResponseBodyAsString(); } }
public void handle(final Response response) throws ResponseException { if (response.isSuccessful()) { success.set(true); } else { errorMessage.set(String.format("Response code: %d: %s", response.getStatusCode(), response.getResponseBodyAsString())); } } });
@Override public void handle(Response response) throws ResponseException { if (!response.isSuccessful()) { throw new ResponseException("Registration failed, received " + response.getStatusCode() + " " + response.getStatusText() + " from peer."); } } });
public String handle(final Response response) throws ResponseException { if (!response.isSuccessful()) { throw new ResponseStatusException("Unexpected response received. Status code: " + response.getStatusCode(), response); } return response.getResponseBodyAsString(); } }
@Override protected IssueCreationResultBean parseResponse(Response response) throws ResponseException, JSONException { if (response.isSuccessful()) { return response.getEntity(IssueCreationResultBean.class); } else { ErrorBean errorBean = response.getEntity(ErrorBean.class); return provideResponseStatus(NegativeResponseStatus.errorOccured(jiraLocation, errorBean)); } } });
@Override protected SuccessfulResponse parseResponse(Response response) throws ResponseException, JSONException { if (response.isSuccessful()) { return SuccessfulResponse.build(jiraLocation); } else { return provideResponseStatus(NegativeResponseStatus.errorOccured(jiraLocation, ResponseUtil.getResponseAsTrimmedString(response))); } }
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; }
private static <T, B extends Builder<T>> RemoteResponse<List<T>> handleResponse(final Response response, final AbstractConfluenceSaxHandler<T, B> handler) throws ResponseException { final String responseString = getResponseBodyAsString(response); List<T> entities = null; ErrorCollection errors = null; if (response.isSuccessful() && !StringUtils.isBlank(responseString)) { entities = parseXml(responseString, handler); if (handler.hasFault()) { errors = new SimpleErrorCollection(); errors.addErrorMessage(handler.getFaultString()); } } return new RemoteResponse<List<T>>(entities, errors, response); }
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; }