Changeset 518
- Timestamp:
- 04/14/07 17:10:14 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/processors/stubJsonRpcProcessor.php
r517 r518 12 12 'net.stubbles.util.validators.stubPassThruValidator', 13 13 'net.stubbles.reflection.reflection', 14 'net.stubbles.service.annotations.stubWebMethodAnnotation'); 14 'net.stubbles.service.annotations.stubWebMethodAnnotation', 15 'net.stubbles.service.stubStatefulService'); 15 16 16 17 /** … … 78 79 $this->generateProxies(); 79 80 } elseif ($this->request->getMethod() === 'get') { 80 $this-> doGET();81 $this->processGetRequest(); 81 82 } else { 82 $this-> doPOST();83 $this->processPostRequest(); 83 84 } 84 85 } … … 89 90 * @param array restrict to classes 90 91 * @todo restrict to classes 91 * @todo Improve service URL detection 92 */ 93 public function generateProxies($class = null) { 92 */ 93 public function generateProxies($classes = null) { 94 94 stubClassLoader::load('net.stubbles.service.jsonrpc.util.stubJsonRpcProxyGenerator'); 95 $generator = new stubJsonRpcProxyGenerator($_SERVER['PHP_SELF'] . '?processor=jsonrpc'); 95 96 $tmp = parse_url($this->request->getURI()); 97 $serviceUrl = '//' . $tmp['path']; 98 if ($this->request->hasValue('processor')) { 99 $processor = $this->request->getValidatedValue(new stubPassThruValidator(), 'processor', stubRequest::SOURCE_PARAM); 100 $serviceUrl .= '?processor='.$processor; 101 } 102 103 $generator = new stubJsonRpcProxyGenerator($serviceUrl); 96 104 $jsCode = ''; 97 105 foreach ($this->classMap as $jsClass => $serviceConfig) { … … 104 112 * Handle a JSON-RPC POST request 105 113 */ 106 public function doPOST() {114 public function processPostRequest() { 107 115 $requestJsonObj = $this->request->getValidatedRawData(new stubPassThruValidator()); 108 116 $phpJsonObj = json_decode($requestJsonObj); … … 174 182 * &id=186252 175 183 */ 176 public function doGET() {184 public function processGetRequest() { 177 185 try { 178 186 $idPattern = new stubRegexValidator(self::ID_PATTERN);
