XmlRpcHandler.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* XmlRpcHandler.qm Copyright (C) 2012 - 2014 David Nichols
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum qore version
// requires the binary xml module
// need mime definitions
// need the Util module
// need HttpServerUtil definitions
// do not use $ for vars
/* Version History
* 2012-05-31 v1.0: David Nichols <david@qore.org>: updated to a user module
* 2013-09-24 v1.1: David Nichols <david@qore.org>: added optional log closure to constructor
*/
namespace XmlRpcHandler {
class XmlRpcHandler : public AbstractHttpRequestHandler {
public:
const Version = "1.0";
const InternalMethods = (
("function": "help",
"help": "shows a list of XML-RPC methods registered with this handler",
"text": "help",
"logopt": 2,
),
("function": "listMethods",
"help": "lists XML-RPC method names registered with this handler",
"text": "system.listMethods",
"logopt": 2,
),
);
const XMLRPC_INVALID_XML = 2001;
private :
list methods = ();
hash mi = hash();
int loglevel;
// if True then verbose exception info will be logged
bool debug;
// prefix to add to derived methods with GET requests if no "." characters are in the path
__7_ string get_prefix;
// a closure/call reference to get the log message and/or process arguments in incoming requests
__7_ code getLogMessage;
// a closure/call reference for logging (when set this is used instead of the HTTP server's logfunc for logging)
__7_ code logc;
public:
constructor(HttpServer::AbstractAuthenticator auth, list methods, __7_ code n_getLogMessage, bool dbg = False, __7_ string n_get_prefix, __7_ code log);
addMethod(string name, code func, string text, string help, int logopt, any cmark);
setDebug(bool dbg = True);
bool getDebug();
// don't reimplement this method; fix/enhance it in the module
final private addMethodInternal(hash h);
private hash help();
private list listMethods();
private log(hash cx, string str);
// don't reimplement this method; fix/enhance it in the module
final private hash callMethod(hash cx, any params);
// method called by HttpServer to handle an XML-RPC request
// don't reimplement this method; fix/enhance it in the module
final hash handleRequest(hash cx, hash hdr, __7_ data body);
};
};
XmlRpcHandler
the XmlRpcHandler namespace holds all public definitions in the XmlRpcHandler module ...
Definition: XmlRpcHandler.qm.dox.h:83