当前位置: 首页>>代码示例>>PHP>>正文


PHP RPC::getClassFromSerializedName方法代码示例

本文整理汇总了PHP中RPC::getClassFromSerializedName方法的典型用法代码示例。如果您正苦于以下问题:PHP RPC::getClassFromSerializedName方法的具体用法?PHP RPC::getClassFromSerializedName怎么用?PHP RPC::getClassFromSerializedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RPC的用法示例。


在下文中一共展示了RPC::getClassFromSerializedName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: decodeRequest

 /**
  * Returns an {@link RPCRequest} that is built by decoding the contents of an
  * encoded RPC request and optionally validating that type can handle the
  * request. If the type parameter is not <code>null</code>, the
  * implementation checks that the type is assignable to the
  * {@link RemoteService} interface requested in the encoded request string.
  *
  * <p>
  * If the serializationPolicyProvider parameter is not <code>null</code>,
  * it is asked for a {@link SerializationPolicy} to use to restrict the set of
  * types that can be decoded from the request. If this parameter is
  * <code>null</code>, then only subtypes of
  * {@link com.google.gwt.user.client.rpc.IsSerializable IsSerializable} or
  * types which have custom field serializers can be decoded.
  * </p>
  *
  * <p>
  * Invoking this method with <code>null</code> for the type parameter,
  * <code>decodeRequest(encodedRequest, null)</code>, is equivalent to
  * calling <code>decodeRequest(encodedRequest)</code>.
  * </p>
  * @param String $encodedRequest a string that encodes the {@link RemoteService}
  *          interface, the service method, and the arguments to pass to the
  *          service method
  * @param MappedClassLoader $mappedClassLoader
  * @param SerializationPolicyProvider $serializationPolicyProvider if not <code>null</code>, the
  *          implementation asks this provider for a
  *          {@link SerializationPolicy} which will be used to restrict the set
  *          of types that can be decoded from this request
  * @return RPCRequest an {@link RPCRequest} instance
  * @throws NullPointerException if the encodedRequest is <code>null</code>
  * @throws IllegalArgumentException if the encodedRequest is an empty string
  * @throws IncompatibleRemoteServiceException if any of the following
  *           conditions apply:
  *           <ul>
  *           <li>if the types in the encoded request cannot be deserialized</li>
  *           <li>if the {@link ClassLoader} acquired from
  *           <code>Thread.currentThread().getClassLoader()</code>
  *           cannot load the service interface or any of the types specified
  *           in the encodedRequest</li>
  *           <li>the requested interface is not assignable to
  *           {@link RemoteService}</li>
  *           <li>the service method requested in the encodedRequest is not a
  *           member of the requested service interface</li>
  *           <li>the type parameter is not <code>null</code> and is not
  *           assignable to the requested {@link RemoteService} interface
  *           </ul>
  */
 public static function decodeRequest($encodedRequest, MappedClassLoader $mappedClassLoader, SerializationPolicyProvider $serializationPolicyProvider)
 {
     $logger = LoggerManager::getLogger('gwtphp.rpc.RPC');
     if ($encodedRequest === null) {
         throw new NullPointerException("encodedRequest cannot be null");
     }
     if (strlen($encodedRequest) == 0) {
         throw new IllegalArgumentException("encodedRequest cannot be empty");
     }
     try {
         /*ServerSerializationStreamReader*/
         $streamReader = new ServerSerializationStreamReader($mappedClassLoader, $serializationPolicyProvider);
         //classLoader, serializationPolicyProvider);
         $streamReader->prepareToRead($encodedRequest);
         // Read the name of the RemoteService interface
         /*String*/
         $serviceIntfName = $streamReader->readString();
         $logger->info("serviceIntfName: " . $serviceIntfName);
         // TODO: wybrac metode sprawdzenia czy posiadamy obiekt ktory moze implementowac wybrany
         // do uruchomienia interface
         //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 = $streamReader->getSerializationPolicy();
         //$gwtService = $classLoader->getMapManager()->getGWTServiceMap($serviceIntfName);
         /*MappedClass*/
         $serviceIntf = null;
         try {
             $serviceIntf = RPC::getClassFromSerializedName($serviceIntfName, $mappedClassLoader);
             //	        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) {
             class_exists('IncompatibleRemoteServiceException') || (require GWTPHP_DIR . '/../com/google/gwt/user/client/rpc/IncompatibleRemoteServiceException.class.php');
             throw new IncompatibleRemoteServiceException("Could not locate requested interface '" + $serviceIntfName + "' in default classloader", $e);
         }
         $serviceMethodName = $streamReader->readString();
         $logger->debug("serviceMethodName: " . $serviceMethodName);
         $paramCount = $streamReader->readInt();
         $logger->debug("paramCount: " . $paramCount);
         /*MappedClass[]*/
         $parameterTypes = array();
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:freemed,代码行数:101,代码来源:RPC.class.php


注:本文中的RPC::getClassFromSerializedName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。