Changeset 955
- Timestamp:
- 10/03/07 11:16:59 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/docroot/index.php
r744 r955 94 94 <li>Event handling<ul><li><a href="events/">Simple example</a></li><li><a href="events/queue.php">Queued events</a></li></ul></li> 95 95 <li> 96 <a href="json-rpc/">Out-of-the-box AJAX with the JSON-RPC processor</a> (<a href="showsource.php?group=json-rpc">show HTML/PHP source</a>, <a href="showsource.php?group=json-rpc&example=jsonrpc">show service source</a>) 96 JSON-RPC 97 <ul> 98 <li> 99 <a href="json-rpc/">Out-of-the-box AJAX with the JSON-RPC processor</a> (<a href="showsource.php?group=json-rpc">show HTML/PHP source</a>, <a href="showsource.php?group=json-rpc&example=jsonrpc">show service source</a>) 100 </li> 101 <li> 102 <a href="json-rpc/dojo.php">Connecting Stubbles JSON-RPC with the Dojo toolkit</a> (<a href="showsource.php?group=json-rpc&example=dojo">show HTML/PHP source</a>) 103 </li> 104 </ul> 97 105 </li> 98 106 <li><a href="foreignClassLoaders/">Loading classes from foreign resources with the Stubbles class loader</a></li> trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php
r944 r955 190 190 if ($this->request->hasValue('processor')) { 191 191 $processor = $this->request->getValidatedValue(new stubPassThruValidator(), 'processor', stubRequest::SOURCE_PARAM); 192 $serviceUrl .= '?processor=' .$processor;193 }194 192 $serviceUrl .= '?processor=' . $processor; 193 $serviceUrl .= '&__class=' . $class; 194 } 195 195 $generator = new stubSmdGenerator($serviceUrl); 196 196 try { … … 255 255 256 256 try { 257 $reflect = $this->getClassAndMethod($phpJsonObj->method); 257 $className = null; 258 if ($this->request->hasValue('__class')) { 259 $className = $this->request->getValidatedValue(new stubPassThruValidator(), '__class'); 260 } 261 $reflect = $this->getClassAndMethod($phpJsonObj->method, $className); 258 262 $result = $this->invokeServiceMethod($reflect['class'], $reflect['method'], $phpJsonObj->params); 259 263 $this->response->writeResponse($phpJsonObj->id, $result); … … 292 296 * 293 297 * @param string $methodName 298 * @param string $className optional, if used with dojo's SMD 294 299 * @return array 295 300 * @throws stubClassNotFoundException 296 301 * @throws stubException 297 302 */ 298 protected function getClassAndMethod($methodName) 299 { 300 if (!preg_match('/'.self::CLASS_AND_METHOD_PATTERN.'/', $methodName)) { 301 throw new stubException('Invalid request: method-Pattern has to be <className>.<methodName>.'); 302 } 303 304 list($className, $methodName) = explode('.', $methodName); 303 protected function getClassAndMethod($methodName, $className = null) 304 { 305 if ($className === null) { 306 if (!preg_match('/'.self::CLASS_AND_METHOD_PATTERN.'/', $methodName)) { 307 throw new stubException('Invalid request: method-Pattern has to be <className>.<methodName>.'); 308 } 309 310 list($className, $methodName) = explode('.', $methodName); 311 } 305 312 if (!isset($this->classMap[$className])) { 306 313 throw new stubException('Unknown class ' . $className . '.'); trunk/src/main/php/net/stubbles/service/jsonrpc/util/stubSmdGenerator.php
r922 r955 64 64 65 65 $methodDef = new stdClass(); 66 $methodDef->name = $ jsClass . '.' . $method->getName();66 $methodDef->name = $method->getName(); 67 67 $methodDef->parameters = array(); 68 68 $smdData->methods[] = $methodDef;
