Source for file NS_JSON_RPC_Service_Handler.php
Documentation is available at NS_JSON_RPC_Service_Handler.php
* nanoserv handlers - JSON-RPC server
* Copyright (C) 2004-2010 Vincent Negrier aka. sIX <six@aegis-corp.org>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* Require the HTTP server
require_once "nanoserv-compat/handlers/NS_HTTP_Service_Handler.php";
* JSON-RPC Service handler class
$ret = array("id" => $req->id);
case JSON_ERROR_DEPTH: $ret["error"] = "The maximum stack depth has been exceeded"; break;
case JSON_ERROR_CTRL_CHAR: $ret["error"] = "Control character error, possibly incorrectly encoded"; break;
case JSON_ERROR_SYNTAX: $ret["error"] = "Syntax error"; break;
default: $ret["error"] = "Unknown error"; break;
$ret["result"] = $this->on_Call($req->method, $req->params);
$ret["error"] = $e->getMessage();
* Event called on JSON-RPC method call
* The value returned by on_Call() will be sent back as the JSON-RPC method call response
abstract public function on_Call($method, $args);
|