Changeset 507
- Timestamp:
- 04/14/07 10:38:47 (1 year ago)
- Files:
-
- trunk/config/php/config-dist.php (modified) (5 diffs)
- trunk/config/php/config.php (modified) (5 diffs)
- trunk/config/xml/json-rpc-service.xml (modified) (1 diff)
- trunk/docroot/jsonrpclab (modified) (1 prop)
- trunk/docroot/jsonrpclab/build.xml (added)
- trunk/src/main/php/info/phing/tasks/stubGenerateJsonRpcProxiesTask.php (added)
- trunk/src/main/php/info/phing/tasks/stubInitTask.php (added)
- trunk/src/main/php/net/stubbles/service/jsonrpc/util/stubJsonRpcProxyGenerator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubJsonRpcProcessor.php (modified) (2 diffs)
- trunk/src/main/resources/xjconf/json-rpc-service.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/php/config-dist.php
r239 r507 7 7 /** 8 8 * this method should return the path to the lib directory 9 * 9 * 10 10 * By default its /path/to/stubbles/lib. 11 11 * … … 16 16 return realpath(dirname(__FILE__) . '/../../lib'); 17 17 } 18 18 19 /** 20 * this method should return the path to the source directory 21 * 22 * By default its /path/to/stubbles/src/main/php. 23 * 24 * @return string 25 */ 26 public static function getSourcePath() 27 { 28 return realpath(dirname(__FILE__) . '/../../src/main/php'); 29 } 30 19 31 /** 20 32 * this method should return the path to the log directory 21 * 33 * 22 34 * By default its /path/to/stubbles/log. 23 35 * … … 28 40 return realpath(dirname(__FILE__) . '/../../log'); 29 41 } 30 42 31 43 /** 32 44 * this method should return the path to the cache directory … … 38 50 return realpath(dirname(__FILE__) . '/../../cache'); 39 51 } 40 52 41 53 /** 42 54 * this method should return the path to the config directory … … 48 60 return realpath(dirname(__FILE__) . '/../'); 49 61 } 50 62 51 63 /** 52 64 * switch to use star files or not trunk/config/php/config.php
r239 r507 7 7 /** 8 8 * this method should return the path to the lib directory 9 * 9 * 10 10 * By default its /path/to/stubbles/lib. 11 11 * … … 16 16 return realpath(dirname(__FILE__) . '/../../lib'); 17 17 } 18 18 19 /** 20 * this method should return the path to the source directory 21 * 22 * By default its /path/to/stubbles/src/main/php. 23 * 24 * @return string 25 */ 26 public static function getSourcePath() 27 { 28 return realpath(dirname(__FILE__) . '/../../src/main/php'); 29 } 30 19 31 /** 20 32 * this method should return the path to the log directory 21 * 33 * 22 34 * By default its /path/to/stubbles/log. 23 35 * … … 28 40 return realpath(dirname(__FILE__) . '/../../log'); 29 41 } 30 42 31 43 /** 32 44 * this method should return the path to the cache directory … … 38 50 return realpath(dirname(__FILE__) . '/../../cache'); 39 51 } 40 52 41 53 /** 42 54 * this method should return the path to the config directory … … 48 60 return realpath(dirname(__FILE__) . '/../'); 49 61 } 50 62 51 63 /** 52 64 * switch to use star files or not trunk/config/xml/json-rpc-service.xml
r504 r507 3 3 xmlns:xj="http://xjconf.net/XJConf" 4 4 xmlns="http://stubbles.net/service/json-rpc"> 5 <service-url>http://localhost/?processor=jsonrpc</service-url> 5 6 <services> 6 7 <service name="BuddyQuoteService" className="_test.service.BuddyQuoteService"/> trunk/docroot/jsonrpclab
- Property svn:ignore changed from
yui
to
yui
generated-scripts
- Property svn:ignore changed from
trunk/src/main/php/net/stubbles/service/jsonrpc/util/stubJsonRpcProxyGenerator.php
r499 r507 7 7 * @subpackage service_jsonrpc 8 8 */ 9 stubClassLoader::load('net.stubbles.service.annotations.stubWebMethodAnnotation'); 9 stubClassLoader::load('net.stubbles.service.annotations.stubWebMethodAnnotation', 10 'net.stubbles.reflection.reflection'); 10 11 11 12 /** … … 19 20 { 20 21 /** 22 * URL of the service 23 * 24 * @var string 25 */ 26 protected $serviceURL; 27 28 /** 29 * Create a new generator 30 * 31 * @param string $serviceURL 32 */ 33 public function __construct($serviceURL) { 34 $this->serviceURL = $serviceURL; 35 } 36 37 /** 21 38 * Generate JS proxy for a specified class 22 39 * … … 26 43 * @return string 27 44 */ 28 staticpublic function generateJavascriptProxy($className, $jsClass = null, $jsCode = '') {45 public function generateJavascriptProxy($className, $jsClass = null, $jsCode = '') { 29 46 30 47 $clazz = new stubReflectionClass($className); … … 33 50 } 34 51 35 $serviceUrl = $_SERVER['PHP_SELF'] . '?processor=jsonrpc';36 37 52 $jsCode .= "function {$jsClass}(clientObj) {\n"; 38 $jsCode .= " this.dispatcher = new stubbles.json.rpc.Client(clientObj, '{$ serviceUrl}');\n";53 $jsCode .= " this.dispatcher = new stubbles.json.rpc.Client(clientObj, '{$this->serviceURL}');\n"; 39 54 $jsCode .= "}\n"; 40 55 trunk/src/main/php/net/stubbles/websites/processors/stubJsonRpcProcessor.php
r506 r507 11 11 'net.stubbles.util.validators.stubRegexValidator', 12 12 'net.stubbles.util.validators.stubPassThruValidator', 13 'net.stubbles.reflection.reflection', 13 14 'net.stubbles.service.annotations.stubWebMethodAnnotation'); 14 15 … … 88 89 * @param array restrict to classes 89 90 * @todo restrict to classes 91 * @todo Improve service URL detection 90 92 */ 91 93 public function generateProxies($class = null) { 92 94 stubClassLoader::load('net.stubbles.service.jsonrpc.util.stubJsonRpcProxyGenerator'); 95 $generator = new stubJsonRpcProxyGenerator($_SERVER['PHP_SELF'] . '?processor=jsonrpc'); 93 96 $jsCode = ''; 94 97 foreach ($this->classMap as $jsClass => $serviceConfig) { 95 $jsCode = stubJsonRpcProxyGenerator::generateJavascriptProxy($serviceConfig['className'], $jsClass, $jsCode);98 $jsCode = $generator->generateJavascriptProxy($serviceConfig['className'], $jsClass, $jsCode); 96 99 } 97 100 $this->response->write($jsCode); trunk/src/main/resources/xjconf/json-rpc-service.xml
r504 r507 3 3 <namespace uri="http://stubbles.net/service/json-rpc"> 4 4 <tag name="services" type="array" /> 5 <tag name="service-url" type="string" /> 5 6 <tag name="service" type="array" keyAttribute="name"> 6 7 <attribute name="name" type="string" required="true"/>
