Package com.google.gwt.user.server.rpc

Examples of com.google.gwt.user.server.rpc.RPCRequest


    }

    @Override
    public String processCall(String payload) throws SerializationException {
        try {
            RPCRequest rpcRequest = StreamServiceUtils.decodeRequest(
                    payload,
                    this.getClass(),
                    this);

            //onAfterRequestDeserialized(rpcRequest);
            StreamServiceIterator iterator = null;

            try {
                iterator = (StreamServiceIterator) rpcRequest.getMethod()
                                                             .invoke(
                        this,
                        rpcRequest.getParameters());

                try {
                    this.sendResults(
                        rpcRequest.getMethod(),
                        iterator,
                        rpcRequest.getSerializationPolicy());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                } finally {
                    if (iterator != null) {
                        iterator.close();
View Full Code Here


  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      Object handler = getBean(getThreadLocalRequest());
      RPCRequest rpcRequest = RPC.decodeRequest(payload, handler.getClass(), this);
      onAfterRequestDeserialized(rpcRequest);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Invoking " + handler.getClass().getName() + "." + rpcRequest.getMethod().getName());
      }
      return RPC.invokeAndEncodeResponse(handler, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest
          .getSerializationPolicy());
    } catch (IncompatibleRemoteServiceException ex) {
      log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    }
View Full Code Here

        if (previousRequest == null) {
            RequestLocator.set(getThreadLocalRequest());
            ResponseLocator.set(getThreadLocalResponse());
        }
        S3RPCRequest request = null;
        RPCRequest rpcRequest = null;
        try {
            CipherFactory.getFactory().clearLimitedKey();
            request = decodeRequest(payload);
            rpcRequest = request.getOriginalRequest();
            onAfterRequestDeserialized(rpcRequest);
            Object result =
                invoke(request.getService(), rpcRequest.getMethod(), rpcRequest
                    .getParameters());
            return RPC.encodeResponseForSuccess(
                rpcRequest.getMethod(),
                result,
                rpcRequest.getSerializationPolicy());
        } catch (IncompatibleRemoteServiceException ex) {
            log(
                "An IncompatibleRemoteServiceException was thrown while processing this call.",
                ex);
            return RPC.encodeResponseForFailure(null, ex);
        } catch (InvocationTargetException ex) {
            Throwable cause = ex.getCause();
            log("An exception was thrown while processing this call.", cause);
            SerializationPolicy sp =
                rpcRequest != null ? rpcRequest.getSerializationPolicy() : null;
            return RPC.encodeResponseForFailure(null, cause, sp);
        } finally {
            if (previousRequest == null) {
                RequestLocator.set(null);
                ResponseLocator.set(null);
View Full Code Here

                Object[] parameterValues = new Object[parameterTypes.length];
                for (int i = 0; i < parameterValues.length; i++) {
                    parameterValues[i] =
                        streamReader.deserializeValue(parameterTypes[i]);
                }
                return new S3RPCRequest(service, new RPCRequest(
                    method,
                    parameterValues,
                    serializationPolicy,
                    streamReader.getFlags()));
View Full Code Here

   */
  public String processCall(String payload) throws SerializationException
  {   
  //  Normal processing
  //
    RPCRequest rpcRequest = null;
    try
    {
    // Decode request
    //
         rpcRequest = RPC.decodeRequest(payload, this.getClass(), this);
        
         if (rpcRequest == null)
         {
           throw new NullPointerException("No rpc request");
         }
       
      //  Invoke method
      //
         GileadRPCHelper.parseInputParameters(rpcRequest, _beanManager,
                             getThreadLocalRequest().getSession());
         Object returnValue = rpcRequest.getMethod().invoke(this, rpcRequest.getParameters());
       
         returnValue = GileadRPCHelper.parseReturnValue(returnValue, _beanManager);
       
      //  Encode response
      // 
        return RPC.encodeResponseForSuccess(rpcRequest.getMethod(),
                               returnValue,
                            rpcRequest.getSerializationPolicy());
      }
    catch (IllegalArgumentException e)
    {
          SecurityException securityException = new SecurityException(
              "Blocked attempt to invoke method " + rpcRequest.getMethod());
          securityException.initCause(e);
          throw securityException;
      }
    catch (IllegalAccessException e)
    {
          SecurityException securityException = new SecurityException(
              "Blocked attempt to access inaccessible method "
                  + rpcRequest.getMethod()
                  + " on target " + this);
          securityException.initCause(e);
          throw securityException;
    }
    catch (InvocationTargetException e)
    {
      // Clone exception if needed
      Exception exception = (Exception) GileadRPCHelper.parseReturnValue(e.getCause(), _beanManager);
     
      return RPC.encodeResponseForFailure(rpcRequest.getMethod(),
                          exception,
                        rpcRequest.getSerializationPolicy());
    }
    catch (IncompatibleRemoteServiceException ex)
    {
      // Clone exception if needed
      Exception exception = (Exception) GileadRPCHelper.parseReturnValue(ex, _beanManager);
      return RPC.encodeResponseForFailure(null, exception, rpcRequest.getSerializationPolicy());
      }
  }
View Full Code Here

  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      Object handler = getBean(getThreadLocalRequest());
      RPCRequest rpcRequest = RPC.decodeRequest(payload, handler.getClass(), this);
      onAfterRequestDeserialized(rpcRequest);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Invoking " + handler.getClass().getName() + "." + rpcRequest.getMethod().getName());
      }
      return RPC.invokeAndEncodeResponse(handler, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest
          .getSerializationPolicy());
    } catch (IncompatibleRemoteServiceException ex) {
      log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    }
View Full Code Here

  }

  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      RPCRequest rpcRequest = RPC.decodeRequest(payload, this.remoteServiceClass, this);
      onAfterRequestDeserialized(rpcRequest);
      return RPC.invokeAndEncodeResponse(this.remoteService, rpcRequest.getMethod(),
          rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
          rpcRequest.getFlags());
    } catch (IncompatibleRemoteServiceException ex) {
      log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    }
  }
View Full Code Here

   */
  public String processCall(String payload) throws SerializationException
  {   
  //  Normal processing
  //
    RPCRequest rpcRequest = null;
    try
    {
    // Decode request
    //
         rpcRequest = RPCCopy.getInstance().decodeRequest(payload, this.getClass(), this);
       
      //  Invoke method
      //
         GileadRPCHelper.parseInputParameters(rpcRequest, _beanManager,
                                getThreadLocalRequest().getSession());
         Object returnValue = RPCCopy.getInstance().invoke(this, rpcRequest.getMethod(),
                             rpcRequest.getParameters(),
                             rpcRequest.getSerializationPolicy());
       
         returnValue = GileadRPCHelper.parseReturnValue(returnValue, _beanManager);
       
      //  Encode response
      // 
        return RPCCopy.getInstance().encodeResponseForSuccess(rpcRequest.getMethod(),
                                      returnValue,
                                      rpcRequest.getSerializationPolicy());
       
      }
    catch (InvocationTargetException e)
    {
      return RPCCopy.getInstance().encodeResponseForFailure(rpcRequest.getMethod(),
                                  e.getCause(),
                                  rpcRequest.getSerializationPolicy());
    }
    catch (IncompatibleRemoteServiceException ex)
    {
          return RPCCopy.getInstance().encodeResponseForFailure(null, ex, rpcRequest.getSerializationPolicy());
      }
  }
View Full Code Here

   */
  @Override
  public String processCall(String payload) throws SerializationException {
    //http://forum.springsource.org/archive/index.php/t-54931.html process request
    try {
      RPCRequest req = RPC.decodeRequest(payload, null, this);

      RemoteService service = (RemoteService) injector.getInstance(req
          .getMethod().getDeclaringClass());
     
      long start = System.currentTimeMillis();
      logger.info("Processing incoming request for " + service.getClass() + "." + req.getMethod());
     
      String result = RPC.invokeAndEncodeResponse(service, req.getMethod(),
          req.getParameters(), req.getSerializationPolicy());
     
      long end = System.currentTimeMillis();
      logger.info("Finished processing in " + (end - start) + " ms");
     
      return result;
View Full Code Here

  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      // decode request parameters
      RPCRequest rpcRequest = RPC.decodeRequest(payload,
          getCurrentHandler().getClass());

      // create proxy that will translate any hibernate specific beans
      // in standard java beans
      Object proxy = this.getProxyForService(getCurrentHandler());

      String retVal = RPC.invokeAndEncodeResponse(proxy, rpcRequest
          .getMethod(), rpcRequest.getParameters());
      return retVal;

    } catch (Throwable t) {
      log.debug("Sending exception to GWT: ", t);
      return RPC.encodeResponseForFailure(null, t);
View Full Code Here

TOP

Related Classes of com.google.gwt.user.server.rpc.RPCRequest

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.