The WWW-RPC sevlet implementation. It is a special kind of servlet that (1) is only instantiated once after mounted (i.e., you instantiate the class and mount that, instead of mounting the class itself), and (2) wraps another service and interface and allows invocation of methods on that service (in the interface) via HTTP.

Methods
Public Class methods
new( service, interface, handlers )

Create a new WWW-RPC servlet.

    # File lib/copland/webrick/www-rpc-servlet-factory.rb, line 67
67:       def initialize( service, interface, handlers )
68:         @service = service
69:         @handlers = handlers
70:         @interface = interface.inject( Hash.new ) do |hash,value|
71:           name = value['alias'] || value['method']
72:           hash[name] = value
73:           hash
74:         end
75:       end
Public Instance methods
do_GET( request, response )

Process a GET request to the servlet. The requested action (the method to invoke) will be taken from the "path_info" property of the request object, minus any leading slash.

The interface for the requested action is then obtained, the argument list build, and the corresponding method invoked on the wrapped service.

Once the requested method returns, the result is run through the handler collection obtained from the factory service that constructed this servlet. Exceptions are processed through the handlers as well.

     # File lib/copland/webrick/www-rpc-servlet-factory.rb, line 88
 88:       def do_GET( request, response )
 89:         requested_action = request.path_info.sub( %r{^/}, "" )
 90: 
 91:         if requested_action == ""
 92:           process_summary_request( request, response )
 93:           return
 94:         end
 95: 
 96:         interface = @interface[ requested_action ]
 97: 
 98:         if interface.nil?
 99:           raise ::WEBrick::HTTPStatus::NotFound,
100:             "the action you requested (#{requested_action}) was not found"
101:         end
102: 
103:         args = ( interface['parameters'] || [] ).map do |name|
104:           request.query[ name ]
105:         end
106:         
107:         begin
108:           result = @service.send( interface['method'], *args )
109: 
110:           unless @handlers.handle( result, request, response )
111:             raise "The data #{result.inspect} (#{result.class}) " +
112:               "could not be handled."
113:           end
114:         rescue Exception => err
115:           @handlers.handle( err, request, response )
116:         end
117:       end
do_HEAD( request, response )

Simply calls do_GET.

     # File lib/copland/webrick/www-rpc-servlet-factory.rb, line 125
125:       def do_HEAD( request, response )
126:         do_GET( request, response )
127:       end
do_POST( request, response )

Simply calls do_GET.

     # File lib/copland/webrick/www-rpc-servlet-factory.rb, line 120
120:       def do_POST( request, response )
121:         do_GET( request, response )
122:       end