List of usage examples for com.google.gwt.http.client Response SC_SERVICE_UNAVAILABLE
int SC_SERVICE_UNAVAILABLE
To view the source code for com.google.gwt.http.client Response SC_SERVICE_UNAVAILABLE.
Click Source Link
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 {/*from ww w . ja va2 s .c o m*/ doFailure(command, callback, counter, reqtime, new Exception("Bad status code ]" + code + "] for command [" + command + "]")); } }
From source file:com.google.appinventor.client.explorer.commands.BuildCommand.java
License:Open Source License
@Override public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); final MessagesOutput messagesOutput = MessagesOutput.getMessagesOutput(); messagesOutput.clear();/* w w w . j ava2 s . c om*/ messagesOutput.addMessages(MESSAGES.buildRequestedMessage(node.getName(), DateTimeFormat.getMediumDateTimeFormat().format(new Date()))); OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>( // failure message MESSAGES.buildError()) { @Override public void onSuccess(RpcResult result) { messagesOutput.addMessages(result.getOutput()); messagesOutput.addMessages(result.getError()); Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_SUBACTION_BUILD_YA, node.getName(), getElapsedMillis()); if (result.succeeded()) { executeNextCommand(node); } else { // The result is the HTTP response code from the build server. int responseCode = result.getResult(); switch (responseCode) { case Response.SC_SERVICE_UNAVAILABLE: // SC_SERVICE_UNAVAILABLE (response code 503), means that the build server is too busy // at this time to accept this build request. // We use ErrorReporter.reportInfo so that the message has yellow background instead of // red background. ErrorReporter.reportInfo(MESSAGES.buildServerBusyError()); break; case Response.SC_CONFLICT: // SC_CONFLICT (response code 409), means that the build server is running a // different version of the App Inventor code. // We use ErrorReporter.reportInfo so that the message has yellow background instead // of red background. ErrorReporter.reportInfo(MESSAGES.buildServerDifferentVersion()); break; default: String errorMsg = result.getError(); // This is not an internal App Inventor bug. The error is reported as info so that // the red background is not shown. ErrorReporter.reportInfo( MESSAGES.buildFailedError() + (errorMsg.isEmpty() ? "" : " " + errorMsg)); break; } executionFailedOrCanceled(); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; String nonce = ode.generateNonce(); ode.getProjectService().build(node.getProjectId(), nonce, target, callback); }
From source file:com.google.appinventor.client.explorer.commands.BuildEclipseProjectCommand.java
License:Open Source License
@Override public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); final MessagesOutput messagesOutput = MessagesOutput.getMessagesOutput(); messagesOutput.clear();//from w w w. j a v a 2 s. co m messagesOutput.addMessages(MESSAGES.buildRequestedMessage(node.getName(), DateTimeFormat.getMediumDateTimeFormat().format(new Date()))); OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>( // failure message MESSAGES.buildError()) { @Override public void onSuccess(RpcResult result) { messagesOutput.addMessages(result.getOutput()); messagesOutput.addMessages(result.getError()); Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_SUBACTION_BUILD_YA, node.getName(), getElapsedMillis()); if (result.succeeded()) { executeNextCommand(node); } else { // The result is the HTTP response code from the build server. int responseCode = result.getResult(); switch (responseCode) { case Response.SC_SERVICE_UNAVAILABLE: // SC_SERVICE_UNAVAILABLE (response code 503), means that the build server is too busy // at this time to accept this build request. // We use ErrorReporter.reportInfo so that the message has yellow background instead of // red background. ErrorReporter.reportInfo(MESSAGES.buildServerBusyError()); break; case Response.SC_CONFLICT: // SC_CONFLICT (response code 409), means that the build server is running a // different version of the App Inventor code. // We use ErrorReporter.reportInfo so that the message has yellow background instead // of red background. ErrorReporter.reportInfo(MESSAGES.buildServerDifferentVersion()); break; default: String errorMsg = result.getError(); // This is not an internal App Inventor bug. The error is reported as info so that // the red background is not shown. ErrorReporter.reportInfo( MESSAGES.buildFailedError() + (errorMsg.isEmpty() ? "" : " " + errorMsg)); break; } executionFailedOrCanceled(); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; ode.getProjectService().buildEclipseProject(node.getProjectId(), target, buildOption, callback); }
From source file:com.google.appinventor.client.explorer.commands.BuildWebCommand.java
License:Open Source License
@Override public void execute(final ProjectNode node) { final Ode ode = Ode.getInstance(); final MessagesOutput messagesOutput = MessagesOutput.getMessagesOutput(); messagesOutput.clear();/*from w w w . ja v a2 s. c o m*/ messagesOutput.addMessages(MESSAGES.buildRequestedMessage(node.getName(), DateTimeFormat.getMediumDateTimeFormat().format(new Date()))); OdeAsyncCallback<RpcResult> callback = new OdeAsyncCallback<RpcResult>( // failure message MESSAGES.buildError()) { @Override public void onSuccess(RpcResult result) { messagesOutput.addMessages(result.getOutput()); messagesOutput.addMessages(result.getError()); Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_SUBACTION_BUILD_YA, node.getName(), getElapsedMillis()); if (result.succeeded()) { executeNextCommand(node); } else { // The result is the HTTP response code from the build server. int responseCode = result.getResult(); switch (responseCode) { case Response.SC_SERVICE_UNAVAILABLE: // SC_SERVICE_UNAVAILABLE (response code 503), means that the build server is too busy // at this time to accept this build request. // We use ErrorReporter.reportInfo so that the message has yellow background instead of // red background. ErrorReporter.reportInfo(MESSAGES.buildServerBusyError()); break; case Response.SC_CONFLICT: // SC_CONFLICT (response code 409), means that the build server is running a // different version of the App Inventor code. // We use ErrorReporter.reportInfo so that the message has yellow background instead // of red background. ErrorReporter.reportInfo(MESSAGES.buildServerDifferentVersion()); break; default: String errorMsg = result.getError(); // This is not an internal App Inventor bug. The error is reported as info so that // the red background is not shown. ErrorReporter.reportInfo( MESSAGES.buildFailedError() + (errorMsg.isEmpty() ? "" : " " + errorMsg)); break; } executionFailedOrCanceled(); } } @Override public void onFailure(Throwable caught) { super.onFailure(caught); executionFailedOrCanceled(); } }; String nonce = ode.generateNonce(); ode.getProjectService().buildDemo(node.getProjectId(), nonce, target, callback); }
From source file:org.obiba.opal.web.gwt.app.client.administration.database.list.DatabaseAdministrationPresenter.java
License:Open Source License
public static void testConnection(EventBus eventBus, String database) { ResourceRequestBuilderFactory.<JsArray<DatabaseDto>>newBuilder() // .forResource(UriBuilders.DATABASE_CONNECTIONS.create().build(database)) // .withCallback(Response.SC_OK, new TestConnectionSuccessCallback(eventBus, database)) // .withCallback(Response.SC_SERVICE_UNAVAILABLE, new TestConnectionFailCallback(eventBus)) // .post().send();/*ww w . j ava 2s . c om*/ }
From source file:org.obiba.opal.web.gwt.app.client.administration.index.presenter.IndexAdministrationPresenter.java
License:Open Source License
@Override protected void onReveal() { breadcrumbsHelper.setBreadcrumbView(getView().getBreadcrumbs()).build(); // stop start search service ResourceRequestBuilderFactory.<ServiceDto>newBuilder().forResource(Resources.searchService()) // .withCallback(new ResourceCallback<ServiceDto>() { @Override/*from w w w . java 2 s.c o m*/ public void onResource(Response response, ServiceDto resource) { if (response.getStatusCode() == Response.SC_OK) { getView().setServiceStatus(resource.getStatus().isServiceStatus(ServiceStatus.RUNNING) ? Display.Status.Stoppable : Display.Status.Startable); } } }) // .get().send(); ResourceRequestBuilderFactory.newBuilder().forResource(Resources.indicesEnabled()) // .withCallback(new ResponseCodeCallback() { @Override public void onResponseCode(Request request, Response response) { getView().setEnabled(response.getStatusCode() == Response.SC_OK); } }, Response.SC_OK, Response.SC_SERVICE_UNAVAILABLE, Response.SC_UNAUTHORIZED)// .get().send(); getView().getIndexTable().setVisibleRange(0, 10); refresh(); }
From source file:org.obiba.opal.web.gwt.app.client.administration.index.presenter.IndexAdministrationPresenter.java
License:Open Source License
@Override public void delete(List<TableIndexStatusDto> statusDtos) { for (TableIndexStatusDto statusDto : statusDtos) { ResponseCodeCallback callback = new ResponseCodeCallback() { @Override/*from www . j a va 2s. co m*/ public void onResponseCode(Request request, Response response) { refresh(); } }; ResourceRequestBuilderFactory.<JsArray<TableIndexStatusDto>>newBuilder()// .forResource(Resources.index(statusDto.getDatasource(), statusDto.getTable())) // .accept("application/json") // .withCallback(callback, Response.SC_OK, Response.SC_SERVICE_UNAVAILABLE) // .delete().send(); getView().unselectIndex(statusDto); } }
From source file:org.obiba.opal.web.gwt.app.client.administration.index.presenter.IndexAdministrationPresenter.java
License:Open Source License
private void refresh(boolean clearIndices) { // Fetch all indices ResourceRequestBuilderFactory.<JsArray<TableIndexStatusDto>>newBuilder()// .forResource(Resources.indices())// .withCallback(new TableIndexStatusResourceCallback(getView().getIndexTable().getVisibleRange(), clearIndices))// .withCallback(Response.SC_SERVICE_UNAVAILABLE, ResponseCodeCallback.NO_OP) // .get().send();/*from ww w . ja v a 2 s . c o m*/ }