1 #ifndef ABYSS_REQHANDLER_XMLRPC_HPP_INCLUDED
2 #define ABYSS_REQHANDLER_XMLRPC_HPP_INCLUDED
3 
4 #include <string>
5 #include <xmlrpc-c/AbyssServer.hpp>
6 #include <xmlrpc-c/registry.hpp>
7 
8 namespace xmlrpc_c {
9 
10 class abyssReqhandlerXmlrpc : public xmlrpc_c::AbyssServer::ReqHandler {
11 /*-----------------------------------------------------------------------------
12    An object of this class is an Abyss request handler that you can
13    use with an Abyss HTTP server object to make it an XML-RPC server.
14 
15    One way to use this is to make a derived class that represents a handler
16    for a certain set of XML-RPC methods.  The derived class' constructor
17    creates an appropriate registry to pass to this base class' constructor.
18 
19    The derived class can also have a 'handleUnreportableFailure' method to
20    deal with RPC failures that the server is unable to report as RPC
21    responses.
22 
23    Note: class abyssServer does not use this class; it uses a C Abyss server
24    instead.
25 -----------------------------------------------------------------------------*/
26 public:
27     abyssReqhandlerXmlrpc(xmlrpc_c::registryPtr const& registryP);
28 
29     void
30     handleRequest(xmlrpc_c::AbyssServer::Session * const sessionP,
31                   bool *                           const handledP);
32 
33 private:
34     xmlrpc_c::registryPtr const registryP;
35 
36     void
37     abortRequest(AbyssServer::Session * const  sessionP,
38                  bool                   const  responseStarted,
39                  AbyssServer::Exception const& e);
40 
41     virtual void
42     handleUnreportableFailure(AbyssServer::Exception const& e);
43         // This method does whatever is appropriate when an RPC fails and the
44         // server is unable to tell the caller.  Logging is typically all one
45         // can do.  The default method, in the base class, does nothing.
46 };
47 
48 }  // namespace
49 
50 #endif
51