File size: 1,844 Bytes
fd49381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef ABYSS_REQHANDLER_XMLRPC_HPP_INCLUDED
#define ABYSS_REQHANDLER_XMLRPC_HPP_INCLUDED

#include <string>
#include <xmlrpc-c/AbyssServer.hpp>
#include <xmlrpc-c/registry.hpp>

namespace xmlrpc_c {

class abyssReqhandlerXmlrpc : public xmlrpc_c::AbyssServer::ReqHandler {
/*-----------------------------------------------------------------------------
   An object of this class is an Abyss request handler that you can
   use with an Abyss HTTP server object to make it an XML-RPC server.

   One way to use this is to make a derived class that represents a handler
   for a certain set of XML-RPC methods.  The derived class' constructor
   creates an appropriate registry to pass to this base class' constructor.
   
   The derived class can also have a 'handleUnreportableFailure' method to
   deal with RPC failures that the server is unable to report as RPC
   responses.

   Note: class abyssServer does not use this class; it uses a C Abyss server
   instead.
-----------------------------------------------------------------------------*/
public:
    abyssReqhandlerXmlrpc(xmlrpc_c::registryPtr const& registryP);

    void
    handleRequest(xmlrpc_c::AbyssServer::Session * const sessionP,
                  bool *                           const handledP);

private:
    xmlrpc_c::registryPtr const registryP;

    void
    abortRequest(AbyssServer::Session * const  sessionP,
                 bool                   const  responseStarted,
                 AbyssServer::Exception const& e);

    virtual void
    handleUnreportableFailure(AbyssServer::Exception const& e);
        // This method does whatever is appropriate when an RPC fails and the
        // server is unable to tell the caller.  Logging is typically all one
        // can do.  The default method, in the base class, does nothing.
};

}  // namespace

#endif