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

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


  public boolean isConnectionSuccess(){
    return status==Status.LOGGED_IN||status==Status.LOGGED_OUT;
  }
  public static LoginInfo getExceptionalLoginInfo(Throwable caught){
    if(caught instanceof StatusCodeException){
      StatusCodeException e=(StatusCodeException)caught;
      switch(e.getStatusCode()){
        case 500:
          return new LoginInfo(Status.SERVER_ERROR);
        case 0:
          return new LoginInfo(Status.OFFLINE);
        default:
View Full Code Here


      listener.onError(new CometException("Unexpected disconnection"), false);
    }
  }
 
  private void onError(int statusCode, String message) {
    listener.onError(new StatusCodeException(statusCode, message), false);
  }
View Full Code Here

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

  public void map(Throwable caught) {
    String header = messages.commonErreurInconnu();
    String content = caught.getMessage();
    if( caught instanceof StatusCodeException ) {
      StatusCodeException scex = (StatusCodeException) caught;
      if( null != scex.getMessage() && regex.test(scex.getMessage()) ) {

        String code = scex.getMessage().substring(4);

        if( code.startsWith("t") ) {
          header = messages.commonTechErreurHeader();
          content = errorMessages.getString(code);
        }
View Full Code Here

        int status = res.getStatusCode();
        if (status != 200) {
          if ((400 <= status && status < 500) && isTextBody(res)) {
            cb.onFailure(new RemoteJsonException(res.getText(), status, null));
          } else {
            cb.onFailure(new StatusCodeException(status, res.getStatusText()));
          }
          return;
        }

        if (!isJsonBody(res)) {
View Full Code Here

        return retriesSoFar*1000;
    }
   
    public boolean shouldRetry(Throwable caught, int retriesSoFar) {
        if(caught instanceof StatusCodeException) {
            StatusCodeException sce = (StatusCodeException)caught;
            int code = sce.getStatusCode();
            // Treat any service temporarily unavailable or "special" IE/Firefox status codes like 0 or 12029
            // as something worth retrying
            // code 0 - Firefox returns this if there's an unexpected connection issue
            // code 12027 and other 12xxx codes are returned by IE when it's being buggy
            // 404 Not Found - Assume the application is being restarted or redeployed, why would be do RPC calls to the wrong URL?
View Full Code Here

        mockRegister(TEST_DOMAIN);

        //caused by callback of register
        List<DomainEvent> theEvents = new ArrayList<DomainEvent>();
        theEvents.add(new DummyDomainEvent(new DummyEvent(), TEST_DOMAIN));
        mockListen(theEvents, 0, new StatusCodeException(0, ""));

        assertFalse(myRemoteEventService.isActive());
        final EventListenerTestMode theRemoteListener = new EventListenerTestMode();
        myRemoteEventService.addListener(TEST_DOMAIN, theRemoteListener);
        assertTrue(myRemoteEventService.isActive());
View Full Code Here

        mockRegister(TEST_DOMAIN);

        //caused by callback of register
        List<DomainEvent> theEvents = new ArrayList<DomainEvent>();
        theEvents.add(new DummyDomainEvent(new DummyEvent(), TEST_DOMAIN));
        mockListen(theEvents, 1, new StatusCodeException(500, ""));
        //one reconnect attempt and one successful call

        assertFalse(myRemoteEventService.isActive());
        final EventListenerTestMode theRemoteListener = new EventListenerTestMode();
        myRemoteEventService.addListener(TEST_DOMAIN, theRemoteListener);
View Full Code Here

      boolean toss = RemoteServiceProxy.isStatsAvailable()
          && RemoteServiceProxy.stats(RemoteServiceProxy.bytesStat(methodName,
          requestId, encodedResponse.length(), "responseReceived"));

      if (statusCode != Response.SC_OK) {
        caught = new StatusCodeException(statusCode, encodedResponse);
      } else if (encodedResponse == null) {
        // This can happen if the XHR is interrupted by the server dying
        caught = new InvocationException("No response payload");
      } else if (RemoteServiceProxy.isReturnValue(encodedResponse)) {
        result = (T) responseReader.read(streamFactory.createStreamReader(encodedResponse));
View Full Code Here

  public Alert(Throwable caught) {
    String title;
    String html;

    if(caught instanceof StatusCodeException) {
      StatusCodeException ex = (StatusCodeException) caught;
      switch(ex.getStatusCode()) {
        case 0:
          title = "Connection Error !";
          html = "An error occurred while attempting to contact the server. Please check your network connection and try again.";
          break;

        case 500:
          title = "Server Error !";
          html = "An error occured at server. Please try again. If problem persists, contact administrator.";
          break;

        default:
          title = "Error " + ex.getStatusCode() + " !";
          html = ex.getEncodedResponse();
      }

    } else if(caught instanceof ServerException) {
      title = "Server Error !";
      html = caught.getMessage();
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.