public HttpClientResponse (Response response) { this.response = response; this.status = new HttpStatus(response.getStatusCode()); }
public HttpClientResponse (Response response) { this.response = response; this.status = new HttpStatus(response.getStatusCode()); }
public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 0) { Utils.handleNetworkConnectionError(); } else { String error = response.getHeader("Error"); String errorType = response.getHeader("ErrorType"); if (!isEmpty(errorType) && "TempCredentials".equals(errorType)) { //change password ChangePasswordDialog.Listener listener = new ChangePasswordDialog.Listener() { @Override public void onChangePassword() { view.clearMessages(); } @Override public void onCancel() { } }; ChangePasswordDialog.showChangePasswordDialog(listener, userName, Utils.messages.tempCredentials()); } else if (!isEmpty(error)) { view.setErrorMessage(error); } else { view.clearMessages(); redirectToModule("kaaAdmin"); } } } });
public void onResponseReceived(Request request, Response response) { wireLogger.finest("Response received"); if (Response.SC_OK == response.getStatusCode()) { String text = response.getText(); receiver.onTransportSuccess(text); } else { String message = SERVER_ERROR + " " + response.getStatusCode() + " " + response.getText(); wireLogger.severe(message); receiver.onTransportFailure(new ServerFailure(message)); } } };
private static void validateContentType(final Response response) { int statusCode = response.getStatusCode(); // in case the response is OK (200), then the content type always has to be 'application/json' if (statusCode == 200) { String contentType = response.getHeader("Content-Type"); if (!contentType.contains("application/json")) { String content = response.getText(); throw new InvalidBusContentException(contentType, content); } } }
@Override public void onResponseReceived(final Request request, final Response response) { validateContentType(response); final int statusCode = response.getStatusCode(); if (statusCode != 200) { switch (statusCode) { case 300: case 301: case 302: case 303: case 304: case 305: case 307: break; default: onError(request, new TransportIOException("unexpected response code: " + statusCode, statusCode, response .getStatusText()), statusCode); return; } } notifyConnected(); BusToolsCli.decodeToCallback(response.getText(), messageBus); if (pendingRequests.isEmpty()) { schedule(); } }
@Override public int getStatusCode() { return response.getStatusCode(); }
validateContentType(response); txActive = false; statusCode = response.getStatusCode();
@Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { renderingCallback.renderTemplate(response.getText()); } else { throw new RuntimeException("Failed to retrieve template from server at " + url + " (status code: " + response.getStatusCode() + ")"); } }
@Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { renderingCallback.renderTemplate(response.getText()); } else { throw new RuntimeException("Failed to retrieve template from server at " + url + " (status code: " + response.getStatusCode() + ")"); } }
public FailedResponseException(Response response) { super(response.getStatusText(), response.getStatusCode()); this.response = response; }
@Override public void onResponseReceived(Request request, Response response) { // when a connection is abruptly closed (for instance when a user presses F5 // the statuscode seems to be 0, the call could have arrived at the server though if (response.getStatusCode() != Response.SC_OK && response.getStatusCode() != 0) { logger.log(Level.SEVERE, "Failed to send server message: [" + response.getStatusText() + "," + response.getStatusCode() + "]"); callback.onFailure(new StatusCodeException(response.getStatusCode(), response.getStatusText())); } else { callback.onSuccess(null); } }
try { String encodedResponse = response.getText(); int statusCode = response.getStatusCode(); boolean toss = statsContext.isStatsAvailable() && statsContext.stats(
@Override public void onResponseReceived(final Request request, final Response response) { GWT.log("got response: " + response.getText() + " (" + response.getStatusCode() + ")"); } @Override
@Override public void onResponseReceived(Request request, Response response) { int status = response.getStatusCode(); if (status == 200) { String s = response.getText(); if (done != null) done.onSuccess(s); } else { String s = url + " >> Response status: " + String.valueOf(status); HttpUtils.logWarn(s); if (done != null) done.onFailure(s); } }
private static void validateContentType(final Response response) { int statusCode = response.getStatusCode(); // in case the response is OK (200), then the content type always has to be 'application/json' if (statusCode == 200) { String contentType = response.getHeader("Content-Type"); if (!contentType.contains("application/json")) { String content = response.getText(); throw new InvalidBusContentException(contentType, content); } } }
@Override public void onResponseReceived(Request request, Response response) { int status = response.getStatusCode(); if (status == 200) { String s = response.getText(); if (done != null) done.onSuccess(s); } else { String s = url + " >> Response status: " + String.valueOf(status); HttpUtils.logWarn(s); if (done != null) done.onFailure(s); } }
@Override public void connect( @Nonnull final OnConnect onConnect, @Nonnull final OnError onConnectError ) { final Consumer<Response> onResponse = r -> onConnectResponse( r.getStatusCode(), r.getStatusText(), r::getText, wrapOnConnect( onConnect ), onConnectError ); sendRequest( RequestBuilder.POST, getBaseConnectionURL(), onResponse, onConnectError::onError ); }
@Test public void testIsKieServerAccessibleWhenStatusCodeIs200() { when(response.getStatusCode()).thenReturn(200); assertTrue(presenter.isKieServerAccessible(response)); }
@Override public void onResponseReceived(final Request request, final Response response) { callback.onResponse(new NRestingResponse(response.getStatusCode(), response.getText(), new NRestingHeaders(response.getHeaders()).setOptions(head), type, new NRestingRequest(builder.getUrl(), head, type, cntr, time, request), System.currentTimeMillis() - time)); }