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 public void handle(Response response) throws ResponseException { if (!response.isSuccessful()) { throw new ResponseException("Registration failed, received " + response.getStatusCode() + " " + response.getStatusText() + " from peer."); } } });
@Override public JerseyRequest setRequestBody(final String s) { delegateRequest.setRequestBody(s); return this; }
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() )); } }
@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 ApplicationStatus handle(final Response response) throws ResponseException { return response.isSuccessful() ? ApplicationStatus.AVAILABLE : ApplicationStatus.UNAVAILABLE; } });
public String execute() throws ResponseException { return request.execute(); }
public <R> R execute(final ApplicationLinkResponseHandler<R> applicationLinkResponseHandler) throws ResponseException { return (R) request.executeAndReturn(applicationLinkResponseHandler); }
public String getNextRedirectLocation(final Response response) throws ResponseException { final String location = response.getHeader("location"); redirects++; return location; }
@Override public JerseyRequest setSoTimeout(final int i) { delegateRequest.setSoTimeout(i); return this; }
@Override protected CopyInformationBean parseResponse(Response response) throws ResponseException, JSONException { return response.getEntity(CopyInformationBean.class); } });
@Override public JerseyRequest addHeader(final String s, final String s1) { delegateRequest.addHeader(s, s1); return this; }
@Override public JerseyRequest setFollowRedirects(final boolean follow) { delegateRequest.setFollowRedirects(follow); return this; }
public Void handle(JerseyResponse jerseyResponse) throws ResponseException { responseHandler.handle(jerseyResponse); return null; } });
@Override public JerseyRequest setUrl(final String s) { delegateRequest.setUrl(s); return this; }
@Override public JerseyRequest setHeader(final String s, final String s1) { delegateRequest.setHeader(s, s1); return this; }
public boolean supportsHeader() { return requestFactory.supportsHeader(); } }
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 public <RET> RET executeAndReturn(final ReturningResponseHandler<? super Response, RET> responseHandler) throws ResponseException { return (RET) request.executeAndReturn(responseHandler); }
@Override protected FieldPermissionsBean parseResponse(Response response) throws ResponseException, JSONException { return response.getEntity(FieldPermissionsBean.class); } });