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

Examples of com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader


    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader =
          new ServerSerializationStreamReader(classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }

      // Read the name of the RemoteService interface
      String serviceIntfName = maybeDeobfuscate(streamReader, streamReader.readString());

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException("Blocked attempt to access interface '"
              + serviceIntfName + "', which is not implemented by '" + printTypeName(type)
              + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class<?> serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either "
                  + "misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException("Could not locate requested interface '"
            + serviceIntfName + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      if (paramCount > streamReader.getNumberOfTokens()) {
        throw new IncompatibleRemoteServiceException("Invalid number of parameters");
      }
      Class<?>[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = maybeDeobfuscate(streamReader, streamReader.readString());

        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName, classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      try {
        Method method = serviceIntf.getMethod(serviceMethodName, parameterTypes);

        // The parameter types we have are the non-parameterized versions in the
        // RPC stream. For stronger message verification, get the parameterized
        // types from the method declaration.
        Type[] methodParameterTypes = method.getGenericParameterTypes();
        DequeMap<TypeVariable<?>, Type> resolvedTypes = new DequeMap<TypeVariable<?>, Type>();

        TypeVariable<Method>[] methodTypes = method.getTypeParameters();
        for (TypeVariable<Method> methodType : methodTypes) {
          SerializabilityUtil.resolveTypes(methodType, resolvedTypes);
        }

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

        return new RPCRequest(method, parameterValues, rpcToken, serializationPolicy, streamReader
            .getFlags());
      } catch (NoSuchMethodException e) {
        throw new IncompatibleRemoteServiceException(formatMethodNotFoundErrorMessage(serviceIntf,
            serviceMethodName, parameterTypes));
      }
View Full Code Here


      //
      onBeforeRequestDeserialized(payload);

      // Create a stream to deserialize the request.
      //
      ServerSerializationStreamReader streamReader = getStreamReader();
      streamReader.prepareToRead(payload);

      // Read the service interface
      //
      String serviceIntfName = streamReader.readString();

      // Read the method name.
      //
      String methodName = streamReader.readString();

      // Read the number and names of the parameter classes from the stream.
      // We have to do this so that we can find the correct overload of the
      // method.
      //
      int paramCount = streamReader.readInt();
      Class[] paramTypes = new Class[paramCount];
      for (int i = 0; i < paramTypes.length; i++)
      {
         String paramClassName = streamReader.readString();
         try
         {
            paramTypes[i] = getClassOrPrimitiveFromName(paramClassName);
         } catch (ClassNotFoundException e)
         {
            throw new SerializationException("Unknown parameter " + i
                  + " type '" + paramClassName + "'", e);
         }
      }

      // Deserialize the parameters.
      //
      Object[] args = new Object[paramCount];
      for (int i = 0; i < args.length; i++)
      {
         args[i] = streamReader.deserializeValue(paramTypes[i]);
      }

      GWTToSeamAdapter adapter = GWTToSeamAdapter.instance();

      // Make the call via reflection.
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      // Read the name of the RemoteService interface
      String serviceIntfName = maybeDeobfuscate(streamReader,
          streamReader.readString());

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class<?> serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      if (paramCount > streamReader.getNumberOfTokens()) {
        throw new IncompatibleRemoteServiceException("Invalid number of parameters");
      }
      Class<?>[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = maybeDeobfuscate(streamReader,
            streamReader.readString());

        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      try {
        Method method = serviceIntf.getMethod(serviceMethodName, parameterTypes);

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

        return new RPCRequest(method, parameterValues, serializationPolicy,
            streamReader.getFlags());

      } catch (NoSuchMethodException e) {
        throw new IncompatibleRemoteServiceException(
            formatMethodNotFoundErrorMessage(serviceIntf, serviceMethodName,
                parameterTypes));
View Full Code Here

        }

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        try {
            ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(classLoader,
                    serializationPolicyProvider);
            streamReader.prepareToRead(encodedRequest);

            // Read the name of the RemoteService interface
            String serviceIntfName = streamReader.readString();

            //            if (type != null) {
            //                if (!implementsInterface(type, serviceIntfName)) {
            //                    // The service does not implement the requested interface
            //                    throw new IncompatibleRemoteServiceException(
            //                        "Blocked attempt to access interface '" +
            //                        serviceIntfName + "', which is not implemented by '" +
            //                        printTypeName(type) +
            //                        "'; this is either misconfiguration or a hack attempt");
            //                }
            //            }
            SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();

            //            Class<?> serviceIntf;

            //            try {
            //                serviceIntf = getClassFromSerializedName(serviceIntfName,
            //                        classLoader);
            //
            //                if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
            //                    // The requested interface is not a RemoteService interface
            //                    throw new IncompatibleRemoteServiceException(
            //                        "Blocked attempt to access interface '" +
            //                        printTypeName(serviceIntf) +
            //                        "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
            //                }
            //            } catch (ClassNotFoundException e) {
            //                throw new IncompatibleRemoteServiceException(
            //                    "Could not locate requested interface '" + serviceIntfName +
            //                    "' in default classloader", e);
            //            }
            String serviceMethodName = streamReader.readString();

            int paramCount = streamReader.readInt();
            Class<?>[] parameterTypes = new Class[paramCount];

            for (int i = 0; i < parameterTypes.length; i++) {
                String paramClassName = streamReader.readString();

                try {
                    parameterTypes[i] = getClassFromSerializedName(paramClassName,
                            classLoader);
                } catch (ClassNotFoundException e) {
                    throw new IncompatibleRemoteServiceException("Parameter " +
                        i + " of is of an unknown type '" + paramClassName +
                        "'", e);
                }
            }

            try {
                Method method = type.getMethod(serviceMethodName, parameterTypes);

                Object[] parameterValues = new Object[parameterTypes.length];

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

                return new RPCRequest(method, parameterValues,
                    serializationPolicy);
            } catch (NoSuchMethodException e) {
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      // Read the name of the RemoteService interface
      String serviceIntfName = streamReader.readString();

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class<?> serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      Class<?>[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = streamReader.readString();
        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      try {
        Method method = serviceIntf.getMethod(serviceMethodName, parameterTypes);

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

        return new RPCRequest(method, parameterValues, serializationPolicy);

      } catch (NoSuchMethodException e) {
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      // Read the name of the RemoteService interface
      String serviceIntfName = streamReader.readString();

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      Class[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = streamReader.readString();
        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      Method method = findInterfaceMethod(serviceIntf, serviceMethodName,
          parameterTypes, true);

      if (method == null) {
        throw new IncompatibleRemoteServiceException(
            formatMethodNotFoundErrorMessage(serviceIntf, serviceMethodName,
                parameterTypes));
      }

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

      return new RPCRequest(method, parameterValues, serializationPolicy);

    } catch (SerializationException ex) {
View Full Code Here

      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

      try
      {
         ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
               classLoader, serializationPolicyProvider);
         streamReader.prepareToRead(encodedRequest);

         // Read the name of the RemoteService interface
         String serviceIntfName = streamReader.readString();

         /*
          * todo?? if (type != null) { if (!implementsInterface(type,
          * serviceIntfName)) { // The service does not implement the requested
          * interface throw new IncompatibleRemoteServiceException(
          * "Blocked attempt to access interface '" + serviceIntfName +
          * "', which is not implemented by '" + printTypeName(type) +
          * "'; this is either misconfiguration or a hack attempt"); } }
          */

         SerializationPolicy serializationPolicy = streamReader
               .getSerializationPolicy();
         Class<?> serviceIntf;
         try
         {
            serviceIntf = RPC_getClassFromSerializedName(serviceIntfName,
                  classLoader);
            if (!RemoteService.class.isAssignableFrom(serviceIntf))
            {
               // The requested interface is not a RemoteService interface
               throw new IncompatibleRemoteServiceException(
                     "Blocked attempt to access interface '"
                           + printTypeName(serviceIntf)
                           + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
            }
         } catch (ClassNotFoundException e)
         {
            throw new IncompatibleRemoteServiceException(
                  "Could not locate requested interface '" + serviceIntfName
                        + "' in default classloader", e);
         }

         String serviceMethodName = streamReader.readString();

         int paramCount = streamReader.readInt();
         Class<?>[] parameterTypes = new Class[paramCount];

         for (int i = 0; i < parameterTypes.length; i++)
         {
            String paramClassName = streamReader.readString();
            try
            {
               parameterTypes[i] = RPC_getClassFromSerializedName(
                     paramClassName, classLoader);
            } catch (ClassNotFoundException e)
            {
               throw new IncompatibleRemoteServiceException("Parameter " + i
                     + " of is of an unknown type '" + paramClassName + "'", e);
            }
         }

         try
         {
            Method method = serviceIntf.getMethod(serviceMethodName,
                  parameterTypes);

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

            return new SeamRPCRequest(method, parameterValues, parameterTypes,
                  serializationPolicy);
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      // Read the name of the RemoteService interface
      String serviceIntfName = streamReader.readString();

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      Class[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = streamReader.readString();
        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      Method method = findInterfaceMethod(serviceIntf, serviceMethodName,
          parameterTypes, true);

      if (method == null) {
        throw new IncompatibleRemoteServiceException(
            formatMethodNotFoundErrorMessage(serviceIntf, serviceMethodName,
                parameterTypes));
      }

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

      return new RPCRequest(method, parameterValues, serializationPolicy);

    } catch (SerializationException ex) {
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      // Read the name of the RemoteService interface
      String serviceIntfName = maybeDeobfuscate(streamReader,
          streamReader.readString());

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class<?> serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      if (paramCount > streamReader.getNumberOfTokens()) {
        throw new IncompatibleRemoteServiceException(
            "Invalid number of parameters");
      }
      Class<?>[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = maybeDeobfuscate(streamReader,
            streamReader.readString());

        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      try {
        Method method = serviceIntf.getMethod(serviceMethodName, parameterTypes);

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

        return new RPCRequest(method, parameterValues, serializationPolicy,
            streamReader.getFlags());

      } catch (NoSuchMethodException e) {
        throw new IncompatibleRemoteServiceException(
            formatMethodNotFoundErrorMessage(serviceIntf, serviceMethodName,
                parameterTypes));
View Full Code Here

    }

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }
           
      // Read the name of the RemoteService interface
      String serviceIntfName = maybeDeobfuscate(streamReader,
          streamReader.readString());

      if (type != null) {
        if (!implementsInterface(type, serviceIntfName)) {
          // The service does not implement the requested interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '" + serviceIntfName
                  + "', which is not implemented by '" + printTypeName(type)
                  + "'; this is either misconfiguration or a hack attempt");
        }
      }

      SerializationPolicy serializationPolicy = streamReader.getSerializationPolicy();
      Class<?> serviceIntf;
      try {
        serviceIntf = getClassFromSerializedName(serviceIntfName, classLoader);
        if (!RemoteService.class.isAssignableFrom(serviceIntf)) {
          // The requested interface is not a RemoteService interface
          throw new IncompatibleRemoteServiceException(
              "Blocked attempt to access interface '"
                  + printTypeName(serviceIntf)
                  + "', which doesn't extend RemoteService; this is either misconfiguration or a hack attempt");
        }
      } catch (ClassNotFoundException e) {
        throw new IncompatibleRemoteServiceException(
            "Could not locate requested interface '" + serviceIntfName
                + "' in default classloader", e);
      }

      String serviceMethodName = streamReader.readString();

      int paramCount = streamReader.readInt();
      if (paramCount > streamReader.getNumberOfTokens()) {
        throw new IncompatibleRemoteServiceException(
            "Invalid number of parameters");
      }
      Class<?>[] parameterTypes = new Class[paramCount];

      for (int i = 0; i < parameterTypes.length; i++) {
        String paramClassName = maybeDeobfuscate(streamReader,
            streamReader.readString());

        try {
          parameterTypes[i] = getClassFromSerializedName(paramClassName,
              classLoader);
        } catch (ClassNotFoundException e) {
          throw new IncompatibleRemoteServiceException("Parameter " + i
              + " of is of an unknown type '" + paramClassName + "'", e);
        }
      }

      try {
        Method method = serviceIntf.getMethod(serviceMethodName, parameterTypes);

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

        return new RPCRequest(method, parameterValues, rpcToken,
            serializationPolicy, streamReader.getFlags());

      } catch (NoSuchMethodException e) {
        throw new IncompatibleRemoteServiceException(
            formatMethodNotFoundErrorMessage(serviceIntf, serviceMethodName,
                parameterTypes));
View Full Code Here

TOP

Related Classes of com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader

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.