Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.StatusCodeException


       
  protected void onReceiving(int statusCode, String responseText, boolean connected) {
    if (statusCode != Response.SC_OK) {
      if (!connected) {
        expectingDisconnection = true;
        listener.onError(new StatusCodeException(statusCode, responseText), connected);
      }
    }
    else {
      int index = responseText.lastIndexOf(SEPARATOR);
      if (index > read) {
View Full Code Here


                        // 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);
                        }
                    }
View Full Code Here

        }
        else {
          statusCode = Integer.parseInt(status.substring(0, index));
          statusMessage = HTTPRequestCometTransport.unescape(status.substring(index + 1));
        }
        listener.onError(new StatusCodeException(statusCode, statusMessage), false);
      }
      catch (NumberFormatException e) {
        listener.onError(new AtmosphereClientException("Unexpected status code: " + status), false);
      }
    }
View Full Code Here

    }
  }
 
  @SuppressWarnings("unused")
  private void onError(int statusCode, String message) {
    listener.onError(new StatusCodeException(statusCode, message), false);
  }
View Full Code Here

        }
        else {
          statusCode = Integer.parseInt(status.substring(0, index));
          statusMessage = HTTPRequestCometTransport.unescape(status.substring(index + 1));
        }
        listener.onError(new StatusCodeException(statusCode, statusMessage), false);
      }
      catch (NumberFormatException e) {
        listener.onError(new AtmosphereClientException("Unexpected status code: " + status), false);
      }
    }
View Full Code Here

        assertFalse(caller.onValidationError(null));
    }

    /** Test onUnhandledError() for HTTP error (FORBIDDEN). */
    @Test public void testOnUnhandledError1() {
        Throwable exception = new StatusCodeException(HttpStatusCode.FORBIDDEN.getValue(), "whatever");
        Caller caller = new Caller();
        caller.onUnhandledError(exception);

        assertEquals("generateNotAuthorized", caller.error.getMessage());
        assertEquals(HttpStatusCode.FORBIDDEN, caller.statusCode);
View Full Code Here

        assertNull(caller.result);
    }

    /** Test onUnhandledError() for HTTP error (not FORBIDDEN or UNAUTHORIZED). */
    @Test public void testOnUnhandledError2() {
        Throwable exception = new StatusCodeException(HttpStatusCode.INTERNAL_SERVER_ERROR.getValue(), "whatever");
        Caller caller = new Caller();
        caller.onUnhandledError(exception);

        assertEquals("generateGeneralRpcErrorWithStatus", caller.error.getMessage());
        assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR, caller.statusCode);
View Full Code Here

        assertNull(caller.result);
    }

    /** Test onUnhandledError() for no response received. */
    @Test public void testOnUnhandledError9() {
        Throwable exception = new StatusCodeException(0, "whatever");
        Caller caller = new Caller();
        caller.onUnhandledError(exception);

        assertEquals("generateNoResponseReceivedError", caller.error.getMessage());
        assertNull(caller.statusCode);
View Full Code Here

        assertNull(caller.result);
    }

    /** Test onUnhandledError() for HTTP error (UNAUTHORIZED). */
    @Test public void testOnUnhandledError10() {
        Throwable exception = new StatusCodeException(HttpStatusCode.UNAUTHORIZED.getValue(), "whatever");
        Caller caller = new Caller();
        caller.onUnhandledError(exception);

        assertEquals("generateNotAuthorized", caller.error.getMessage());
        assertEquals(HttpStatusCode.UNAUTHORIZED, caller.statusCode);
View Full Code Here

  }
 
  private void showError(Throwable caught){
    progressLabel.setText(ERROR_TEXT);
    if(caught instanceof StatusCodeException){
      StatusCodeException e=(StatusCodeException)caught;
      switch(e.getStatusCode()){
        case 500:
          table.showText("Server error occurred.");
          break;
        case 0:
          table.showText("Offline.");
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.StatusCodeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.