本文整理汇总了PHP中RPC::formatMethodNotFoundErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP RPC::formatMethodNotFoundErrorMessage方法的具体用法?PHP RPC::formatMethodNotFoundErrorMessage怎么用?PHP RPC::formatMethodNotFoundErrorMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RPC
的用法示例。
在下文中一共展示了RPC::formatMethodNotFoundErrorMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decodeRequest
//.........这里部分代码省略.........
* <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();
for ($i = 0; $i < $paramCount; ++$i) {
$paramClassName = $streamReader->readString();
//$parameterTypes[$i] = $paramClassName;
try {
$parameterTypes[$i] = RPC::getClassFromSerializedName($paramClassName, $mappedClassLoader);
} catch (ClassNotFoundException $e) {
class_exists('IncompatibleRemoteServiceException') || (require GWTPHP_DIR . '/../com/google/gwt/user/client/rpc/IncompatibleRemoteServiceException.class.php');
throw new IncompatibleRemoteServiceException("Parameter " + $i + " of is of an unknown type '" + $paramClassName + "'", $e);
}
}
$logger->info(print_r($parameterTypes, true));
$mappedMethod = RPC::findInterfaceMethod($serviceIntf, $serviceMethodName, $parameterTypes, true);
if ($mappedMethod == null) {
class_exists('IncompatibleRemoteServiceException') || (require GWTPHP_DIR . '/../com/google/gwt/user/client/rpc/IncompatibleRemoteServiceException.class.php');
throw new IncompatibleRemoteServiceException(RPC::formatMethodNotFoundErrorMessage($serviceIntf, $serviceMethodName, $parameterTypes));
}
/*Object[]*/
$parameterValues = array();
for ($i = 0; $i < $paramCount; ++$i) {
$parameterValues[$i] = $streamReader->deserializeValue($parameterTypes[$i]);
}
$logger->info(print_r($parameterValues, true));
//$gwtService->getServiceMethodMap(0)->getMethod();
//
//$rpcResolver->
//$method = $rpcResolver->getRPCServiceMethod($serviceIntfName,$serviceMethodName);
//$rpcRequest = new RPCRequest($method, $parameterValues, $serializationPolicy);
//$rpcRequest->setClass($service);
// $rpcRequest = $rpcResolver->getRPCRequest($serviceIntfName,$serviceMethodName,$parameterTypes);
// $rpcRequest->setParameters($parameterValues);
// $rpcRequest->setSerializationPolicy($serializationPolicy);
return new RPCRequest($mappedMethod, $parameterValues, $serializationPolicy, $mappedClassLoader);
} catch (SerializationException $ex) {
class_exists('IncompatibleRemoteServiceException') || (require GWTPHP_DIR . '/../com/google/gwt/user/client/rpc/IncompatibleRemoteServiceException.class.php');
throw new IncompatibleRemoteServiceException($ex->getMessage(), $ex);
}
}