Changeset 1237

Show
Ignore:
Timestamp:
01/14/08 17:05:01 (6 months ago)
Author:
richi
Message:

enhancement #115: 'latecomer' bugfix which ensures that dynamically generated proxies work | fixed also example

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/examples/build.xml

    r710 r1237  
    33  <property name="examples.base.dir" value="${project.basedir}" /> 
    44  <property file="examples.properties" /> 
     5  <property name="javascript.srcpath" value="../src/main/javascript" /> 
    56 
    67  <target name="main" depends="prepare-examples, foreignClassLoader, json-rpc" description="Setup all examples" /> 
  • trunk/examples/docroot/json-rpc/index.php

    r1234 r1237  
    2828} 
    2929?> 
    30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    31     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     30<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     31    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    3232<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> 
    3333<head> 
     
    5151  <script type="text/javascript" src="../javascript/stub-base.js"></script> 
    5252  <script type="text/javascript" src="../javascript/stub-json-rpc.js"></script> 
    53   <script type="text/javascript" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&__generateProxy=__all"></script> 
     53  <script type="text/javascript" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&amp;__generateProxy=__all"></script> 
    5454<script type="text/javascript"> 
    5555var MathCallbackObj = { 
     
    5858  } 
    5959}; 
    60 var math = new MathService(MathCallbackObj); 
     60var math = new stubbles.json.proxy.MathService(MathCallbackObj); 
    6161 
    6262var NameCallbackObj = { 
     
    6868  } 
    6969}; 
    70 var nameServ = new NameService(NameCallbackObj); 
     70var nameServ = new stubbles.json.proxy.NameService(NameCallbackObj); 
    7171 
    7272// make sure, that the session id is used for all requests 
    73 stubbles.json.rpc.appendToURL = '&<?php echo $session->getName(); ?>=<?php echo $session->getId(); ?>'; 
     73stubbles.json.rpc.appendToURL = '&amp;<?php echo $session->getName(); ?>=<?php echo $session->getId(); ?>'; 
     74stubbles.json.rpc.serviceUrl  = 'jsonrpc.php?processor=jsonrpc'; 
    7475</script> 
     76</head> 
     77<body> 
    7578 
    7679<h1>JSON-RPC examples</h1> 
     
    8689  <p> 
    8790   SMD for this service:<br/> 
    88    <iframe height="50" width="100%" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&__smd=MathService"></iframe> 
     91   <iframe height="50" width="100%" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&amp;__smd=MathService"></iframe> 
    8992  </p> 
    9093</fieldset> 
     
    102105  <p> 
    103106   SMD for this service:<br/> 
    104    <iframe height="50" width="100%" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&__smd=NameService"></iframe> 
     107   <iframe height="50" width="100%" src="<?php echo dirname($_SERVER['PHP_SELF']);?>/jsonrpc.php?processor=jsonrpc&amp;__smd=NameService"></iframe> 
    105108  </p> 
    106109</fieldset> 
    107  
    108 </head> 
    109 <body> 
    110110</body> 
    111111</html> 
  • trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php

    r1226 r1237  
    149149     * @param  array  $classes  optional  restrict to this list of classes 
    150150     */ 
    151     public function generateProxies($classes = null
     151    public function generateProxies($classes = null, $jsNamespace = 'stubbles.json.proxy'
    152152    { 
    153153        stubClassLoader::load('net::stubbles::service::jsonrpc::util::stubJsonRpcProxyGenerator'); 
     
    159159        } 
    160160 
     161        $this->response->write($jsNamespace . " = {};\n\n"); 
    161162        $generator = new stubJsonRpcProxyGenerator($serviceUrl); 
    162163        foreach ($this->classMap as $jsClass => $serviceConfig) { 
     
    192193        } 
    193194        $generator = new stubSmdGenerator($serviceUrl); 
     195        // get rid of namespace for class matching 
     196        $class = preg_replace('/stubbles\.json\.proxy\./', '', $class); 
    194197        $classInfo = $this->classMap[$class]; 
    195198        try { 
  • trunk/src/main/resources/phing/build-stubbles.xml

    r1165 r1237  
    6666 
    6767        <append destFile="build.properties" text="jsonrpc.clients.dir=${jsonrpc.clients.dir}${line.separator}"/> 
    68         <append destFile="build.properties" text="jsonrpc.clients.ns=${jsonrpc.clients.ns}"/> 
     68        <append destFile="build.properties" text="jsonrpc.clients.ns=${jsonrpc.clients.ns}${line.separator}"/> 
    6969        <copy file="${stubbles.config.path}/xml/json-rpc-service-dist.xml" tofile="${stubbles.config.path}/xml/json-rpc-service.xml" overwrite="true"> 
    7070          <filterchain>