Example usage for com.google.gwt.http.client Response SC_BAD_GATEWAY

List of usage examples for com.google.gwt.http.client Response SC_BAD_GATEWAY

Introduction

In this page you can find the example usage for com.google.gwt.http.client Response SC_BAD_GATEWAY.

Prototype

int SC_BAD_GATEWAY

To view the source code for com.google.gwt.http.client Response SC_BAD_GATEWAY.

Click Source Link

Usage

From source file:com.ait.tooling.nativetools.client.rpc.JSONCommandRequest.java

License:Open Source License

protected void onBadStatusCode(final RequestBuilder builder, final String command, final long counter,
        final long reqtime, final AsyncCallback<NObject> callback, final int code) {
    if (Response.SC_NOT_FOUND == code) {
        doFailure(command, callback, counter, reqtime,
                new Exception("Code [" + code + "]: Command [" + command + "] not found "));
    } else if (Response.SC_FORBIDDEN == code) {
        doFailure(command, callback, counter, reqtime,
                new Exception("Code [" + code + "]: No permission or Session expired"));
    } else if (Response.SC_BAD_GATEWAY == code) {
        doFailure(command, callback, counter, reqtime,
                new Exception("Code [" + code + "]: Misconfigured Gateway"));
    } else if ((0 == code) || (Response.SC_SERVICE_UNAVAILABLE == code)) {
        doFailure(command, callback, counter, reqtime,
                new Exception("Code [" + code + "]: Server appears to be down"));
    } else {/*w ww . ja v  a  2 s. c  o m*/
        doFailure(command, callback, counter, reqtime,
                new Exception("Bad status code ]" + code + "] for command [" + command + "]"));
    }
}