Source for file jJsonRpcRequest.class.php

Documentation is available at jJsonRpcRequest.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  core_request
  5. @author      Laurent Jouanneau
  6. @copyright   2005-2011 Laurent Jouanneau
  7. @link        http://www.jelix.org
  8. @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  9. */
  10.  
  11. /**
  12.  * the jJsonRpcRequest require jJsonRpc class
  13.  */
  14. require(JELIX_LIB_UTILS_PATH.'jJsonRpc.class.php');
  15.  
  16. /**
  17. * handle a JSON-rpc call. The response has to be a json rpc response.
  18. @package  jelix
  19. @subpackage core_request
  20. */
  21. class jJsonRpcRequest extends jRequest {
  22.  
  23.     public $type = 'jsonrpc';
  24.  
  25.     public $defaultResponseType = 'jsonrpc';
  26.  
  27.     public $authorizedResponseClass = 'jResponseJsonrpc';
  28.  
  29.     public $jsonRequestId = null;
  30.  
  31.     /**
  32.      * Analyze the HTTP request and set the params property
  33.      */
  34.     protected function _initParams(){
  35.         global $HTTP_RAW_POST_DATA;
  36.         if(isset($HTTP_RAW_POST_DATA)){
  37.             $request $HTTP_RAW_POST_DATA;
  38.         }else{
  39.             $request file('php://input');
  40.             $request implode("\n",$request);
  41.         }
  42.  
  43.         // Decode the request
  44.         $requestobj jJsonRpc::decodeRequest($request);
  45.         if($requestobj['method']){
  46.             list($module$actionexplode('~',$requestobj['method']);
  47.         }else{
  48.             $module='';
  49.             $action='';
  50.         }
  51.         if(isset$requestobj['id']))
  52.             $this->jsonRequestId = $requestobj['id'];
  53.  
  54.         if(is_array($requestobj['params']))
  55.             $this->params = $requestobj['params'];
  56.  
  57.         $this->params['params'$requestobj['params'];
  58.  
  59.         // Definition of action to use and its parameters
  60.         $this->params['module'$module;
  61.         $this->params['action'$action;
  62.     }
  63. }

Documentation generated on Wed, 04 Jan 2017 22:55:41 +0100 by phpDocumentor 1.4.3