Examples of RpcRequest


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

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

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

  @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

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

  }

  @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

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

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

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

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

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

  @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

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

      // class specified in the request
      if ( altLoader != origLoader ) {
        Thread.currentThread().setContextClassLoader( altLoader );
      }

      RPCRequest rpcRequest = RPC.decodeRequest( payload, null, this );
      onAfterRequestDeserialized( rpcRequest );
      // don't require the server side to implement the service interface
      Method method = rpcRequest.getMethod();
      try {
        Method m = target.getClass().getMethod( method.getName(), method.getParameterTypes() );
        if ( m != null ) {
          method = m;
        }
      } catch ( Exception e ) {
        e.printStackTrace();
      }
      return RPC.invokeAndEncodeResponse( target, method, rpcRequest.getParameters(), rpcRequest
          .getSerializationPolicy() );
    } catch ( IncompatibleRemoteServiceException ex ) {
      logger.error( Messages.getInstance().getErrorString(
          "AbstractGwtRpcProxyServlet.ERROR_0003_RPC_INVOCATION_FAILED", target.getClass().getName() ), ex ); //$NON-NLS-1$
      return RPC.encodeResponseForFailure( null, ex );
View Full Code Here

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

   * that encodes either the method return or an exception thrown by it.
   */
  @Override
  public String processCall(String payload) throws SerializationException {
    try {
      RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass());
      return RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(),
          rpcRequest.getParameters());
    } catch (IncompatibleRemoteServiceException ex) {
      return RPC.encodeResponseForFailure(null, ex);
    }
  }
View Full Code Here

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

      HttpServletResponse httpResponse) {
    String payload = readPayloadAsUtf8(httpRequest);

    try {
      try {
        RPCRequest rpcRequest = RPC.decodeRequest(payload);

        Object targetInstance = getInstanceToHandleRequest(httpRequest,
            rpcRequest);

        Method targetMethod = maybeMapRequestedMethod(targetInstance,
            rpcRequest.getMethod());

        Object[] targetParameters = maybeMapParameters(rpcRequest.getParameters());

        try {
          Object result = targetMethod.invoke(targetInstance, targetParameters);

          result = maybeMapResult(rpcRequest.getMethod(), result);

          /*
           * Encode the object that will be given to the client code's
           * AsyncCallback::onSuccess(Object) method.
           */
          String encodedResult = RPC.encodeResponseForSuccess(
              rpcRequest.getMethod(), result);

          sendResponseForSuccess(httpResponse, encodedResult);
        } catch (IllegalArgumentException e) {
          SecurityException securityException = new SecurityException(
              "Blocked attempt to invoke method " + targetMethod);
          securityException.initCause(e);
          throw securityException;
        } catch (IllegalAccessException e) {
          SecurityException securityException = new SecurityException(
              "Blocked attempt to access inaccessible method "
                  + targetMethod
                  + (targetInstance != null ? " on target " + targetInstance
                      : ""));
          securityException.initCause(e);
          throw securityException;
        } catch (InvocationTargetException e) {
          Throwable cause = e.getCause();

          Throwable mappedThrowable = maybeMapThrowable(cause,
              rpcRequest.getMethod());

          /*
           * Encode the exception that will be passed back to the client's
           * client code's AsyncCallback::onFailure(Throwable) method.
           */
          String failurePayload = RPC.encodeResponseForFailure(
              rpcRequest.getMethod(), mappedThrowable);

          sendResponseForFailure(httpResponse, failurePayload);
        }
      } catch (IncompatibleRemoteServiceException e) {
        sendResponseForFailure(httpResponse, RPC.encodeResponseForFailure(null,
View Full Code Here

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

    {
      if (log.isDebugEnabled())
      {
        log.debug("currentHandler = [" + getCurrentHandler().getClass() + "], payload = [" + payload);
      }
      final RPCRequest rpcRequest = RPC.decodeRequest(payload, getCurrentHandler().getClass(), this);
      if (log.isDebugEnabled())
      {
        log.debug("rpcRequest = [" + rpcRequest + "] rpcRequest.getSerializationPolicy() = ["
            + rpcRequest.getSerializationPolicy() + "]");
      }
      onAfterRequestDeserialized(rpcRequest);
      final String response = RPC.invokeAndEncodeResponse(getCurrentHandler(), rpcRequest.getMethod(),
          rpcRequest.getParameters(), rpcRequest.getSerializationPolicy());
      if (log.isDebugEnabled())
      {
        log.debug("response = [" + response + "]");
      }
      return response;
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.