Examples of StatusCodeException


Examples of com.getperka.flatpack.client.StatusCodeException

      }
    }

    // Treat any non-2XX response as an error
    if (!isOk(status)) {
      StatusCodeException sce = new StatusCodeException(status, cause);
      sce.setEntity(entity);
      throw sce;
    }

    return entity;
  }
View Full Code Here

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

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

                        // 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

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

        }
        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

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

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

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

        }
        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

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

        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

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

        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

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

        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

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

        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
TOP
Copyright © 2018 www.massapi.com. 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.