Examples of RpcRequest


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

    // no known constants to use in this case
    String result = null;

    // get the RPC Request from the request data
    //RPCRequest rpcRequest= RPC.decodeRequest(payload);
    RPCRequest rpcRequest = RPC.decodeRequest(payload,null,this);
 
   
     onAfterRequestDeserialized(rpcRequest);
    
    // get the parameter types for the method look-up
    Class<?>[] paramTypes = rpcRequest.getMethod().getParameterTypes();       
    paramTypes = rpcRequest.getMethod().getParameterTypes();

    // we need to get the action method from Struts
    Method method = findInterfaceMethod(
        actionInvocation.getAction().getClass(),
        rpcRequest.getMethod().getName(),
        paramTypes, true);

    // if the method is null, this may be a hack attempt
    // or we have some other big problem
    if (method == null) {
      // present the params
      StringBuffer params = new StringBuffer();
      for (int i=0; i < paramTypes.length; i++) {
        params.append(paramTypes[i]);
        if (i < paramTypes.length-1) {
          params.append(", ");
        }
      }

      // throw a security exception, could be attempted hack
      throw new GWTServletException(
          "Failed to locate method "+ rpcRequest.getMethod().getName()
          + "("+ params +") on interface "
          + actionInvocation.getAction().getClass().getName()
          + " requested through interface "
          + rpcRequest.getClass().getName());
    }

 
    Object callResult = null;
    try {
      callResult = method.invoke(actionInvocation.getAction(),
          rpcRequest.getParameters());
      // package  up response for GWT
      result = RPC.encodeResponseForSuccess(method, callResult);
     
    } catch (Exception e) {
      // check for checked exceptions
      if (e.getCause() != null) {
        Throwable cause = e.getCause();
        boolean found = false;
        for (Class<?> checkedException : rpcRequest.getMethod().getExceptionTypes()){
          if (cause.getClass().equals(checkedException)) {
            found = true;
            break;
          }
        }
        if (!found) {
          throw new GWTServletException("Unchecked exception: " + e.getCause().getClass().getName());
        }
        result = RPC.encodeResponseForFailure(null, e.getCause(), rpcRequest.getSerializationPolicy());
      } else {
        throw new GWTServletException("Unable to serialize the exception.");
      }
    }
View Full Code Here

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

    assert clientOracle != null : "clientOracle";
    assert payload != null : "payload";
    assert stream != null : "stream";

    try {
      RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass(),
          clientOracle);
      onAfterRequestDeserialized(rpcRequest);
      RPC.invokeAndStreamResponse(this, rpcRequest.getMethod(),
          rpcRequest.getParameters(), clientOracle, stream);
    } catch (RemoteException ex) {
      throw new SerializationException("An exception was sent from the client",
          ex.getCause());
    } catch (IncompatibleRemoteServiceException ex) {
      log(
View Full Code Here

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

    boolean localeInitializedByServlet = false;
    try
    {
      localeInitializedByServlet = initUserLocaleResolver();
      Object service = getServiceForRequest(payload);
      RPCRequest rpcRequest = RPC.decodeRequest(payload, service.getClass(), this);
      onAfterRequestDeserialized(rpcRequest);

      //TODO: criar um ponto de injecao de comportamento aki.... para permitir que plugins sejam criados (ex: seguranca, logs, etc)
      CruxSynchronizerTokenHandler handler = CruxSynchronizerTokenHandlerFactory.getCruxSynchronizerTokenHandler(getThreadLocalRequest());

      boolean useToken = checkSynchonizerToken(rpcRequest, handler);
      try
      {
        return RPC.invokeAndEncodeResponse(service, rpcRequest.getMethod(),
            rpcRequest.getParameters(), rpcRequest.getSerializationPolicy());
      }
      finally
      {
        if (useToken)
        {
          String methodFullSignature = handler.getMethodDescription(rpcRequest.getMethod());
          handler.endMethod(methodFullSignature);
        }
      }
    }
    catch (IncompatibleRemoteServiceException ex)
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 {
        RemoteService remoteService = null;
        RPCRequest rpcRequest = null;
        try {
            remoteService = (RemoteService) applicationContext.getBean(remoteServiceName);
            setServiceData(remoteService, false);

            rpcRequest = RPC.decodeRequest(payload, remoteService.getClass(), this);
           
            if (logger.isDebugEnabled()) {
                logger.debug("Executing method " + rpcRequest.getMethod());
            }

            return RPC.invokeAndEncodeResponse(remoteService, rpcRequest
                    .getMethod(), rpcRequest.getParameters(), rpcRequest
                    .getSerializationPolicy());
        } catch (Exception e) {
            if (rpcRequest != null) {
                logger.error("An error occurred calling the GWT service method " + rpcRequest.getMethod() + ". Cause: " + e.getMessage(), e);
            } else {
                logger.error("An error occurred calling the GWT service " + (remoteService != null ? remoteService.getClass().getName() : remoteServiceName) + ". Cause: " + e.getMessage(), e);
            }
            return RPC.encodeResponseForFailure(null, e);
        } finally {
View Full Code Here

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

                for (int i = 0; i < parameterValues.length; i++) {
                    parameterValues[i] = streamReader.deserializeValue(parameterTypes[i]);
                }

                return new RPCRequest(method, parameterValues,
                    serializationPolicy, 0);
            } catch (NoSuchMethodException e) {
                throw new IncompatibleRemoteServiceException(formatMethodNotFoundErrorMessage(
                        type, serviceMethodName, parameterTypes));
            }
View Full Code Here

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

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

        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

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

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