Package com.google.gwt.rpc.client.ast

Examples of com.google.gwt.rpc.client.ast.CommandSink


    if (clientOracle == null) {
      throw new NullPointerException("clientOracle");
    }

    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(stream);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }

    try {
      Object result = serviceMethod.invoke(target, args);
      try {
        streamResponse(clientOracle, result, sink, false);
      } catch (SerializationException e) {
        streamResponse(clientOracle, e, sink, true);
      }

    } catch (IllegalAccessException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalAccessErrorMessage(target, serviceMethod));
      securityException.initCause(e);
      throw securityException;
    } catch (IllegalArgumentException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalArgumentErrorMessage(target, serviceMethod, args));
      securityException.initCause(e);
      throw securityException;
    } catch (InvocationTargetException e) {
      // Try to encode the caught exception
      //
      Throwable cause = e.getCause();

      streamResponse(clientOracle, cause, sink, true);
    }
    sink.finish();
  }
View Full Code Here


    sink.finish();
  }

  public static void streamResponseForFailure(ClientOracle clientOracle,
      OutputStream out, Throwable payload) throws SerializationException {
    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(out);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }
    streamResponse(clientOracle, payload, sink, true);
    sink.finish();
  }
View Full Code Here

    sink.finish();
  }

  public static void streamResponseForSuccess(ClientOracle clientOracle,
      OutputStream out, Object payload) throws SerializationException {
    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(out);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }
    streamResponse(clientOracle, payload, sink, false);
    sink.finish();
  }
View Full Code Here

    if (clientOracle == null) {
      throw new NullPointerException("clientOracle");
    }

    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(stream);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }

    try {
      Object result = serviceMethod.invoke(target, args);
      try {
        streamResponse(clientOracle, result, sink, false);
      } catch (SerializationException e) {
        streamResponse(clientOracle, e, sink, true);
      }

    } catch (IllegalAccessException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalAccessErrorMessage(target, serviceMethod));
      securityException.initCause(e);
      throw securityException;
    } catch (IllegalArgumentException e) {
      SecurityException securityException = new SecurityException(
          formatIllegalArgumentErrorMessage(target, serviceMethod, args));
      securityException.initCause(e);
      throw securityException;
    } catch (InvocationTargetException e) {
      // Try to encode the caught exception
      Throwable cause = e.getCause();

      // Don't allow random RuntimeExceptions to be thrown back to the client
      if (!RPCServletUtils.isExpectedException(serviceMethod, cause)) {
        throw new UnexpectedException("Service method '"
            + getSourceRepresentation(serviceMethod)
            + "' threw an unexpected exception: " + cause.toString(), cause);
      }

      streamResponse(clientOracle, cause, sink, true);
    }
    sink.finish();
  }
View Full Code Here

    sink.finish();
  }

  public static void streamResponseForFailure(ClientOracle clientOracle,
      OutputStream out, Throwable payload) throws SerializationException {
    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(out);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }
    streamResponse(clientOracle, payload, sink, true);
    sink.finish();
  }
View Full Code Here

    sink.finish();
  }

  public static void streamResponseForSuccess(ClientOracle clientOracle,
      OutputStream out, Object payload) throws SerializationException {
    CommandSink sink;
    try {
      sink = clientOracle.createCommandSink(out);
    } catch (IOException e) {
      throw new SerializationException("Unable to initialize output", e);
    }
    streamResponse(clientOracle, payload, sink, false);
    sink.finish();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.rpc.client.ast.CommandSink

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.