Package com.google.gwt.requestfactory.shared

Examples of com.google.gwt.requestfactory.shared.ServerFailure


    public void processPayload(final Receiver<Void> receiver, String payload) {
      ResponseMessage response = AutoBeanCodex.decode(
          MessageFactoryHolder.FACTORY, ResponseMessage.class, payload).as();
      if (response.getGeneralFailure() != null) {
        ServerFailureMessage failure = response.getGeneralFailure();
        ServerFailure fail = new ServerFailure(failure.getMessage(),
            failure.getExceptionType(), failure.getStackTrace(),
            failure.isFatal());

        fail(receiver, fail);
        return;
      }

      // Process violations and then stop
      if (response.getViolations() != null) {
        Set<Violation> errors = new HashSet<Violation>();
        for (ViolationMessage message : response.getViolations()) {
          errors.add(new MyViolation(message));
        }

        violation(receiver, errors);
        return;
      }

      // Process operations
      processReturnOperations(response);

      // Send return values
      Set<Throwable> causes = null;
      for (int i = 0, j = invocations.size(); i < j; i++) {
        try {
          if (response.getStatusCodes().get(i)) {
            invocations.get(i).onSuccess(response.getInvocationResults().get(i));
          } else {
            ServerFailureMessage failure = AutoBeanCodex.decode(
                MessageFactoryHolder.FACTORY, ServerFailureMessage.class,
                response.getInvocationResults().get(i)).as();
            invocations.get(i).onFail(
                new ServerFailure(failure.getMessage(),
                    failure.getExceptionType(), failure.getStackTrace(),
                    failure.isFatal()));
          }
        } catch (Throwable t) {
          if (causes == null) {
View Full Code Here

TOP

Related Classes of com.google.gwt.requestfactory.shared.ServerFailure

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.