Hey Toby,

Part of Mongrel's design is that you don't have to send me patches to give
people these kinds of features.  You can use the GemPlugin system to create
your own handlers, commands, and pretty much anything else Mongrel needs to
implement this.  Then, provide some simple instructions and people can get
XML-RPC by just installing your gem and doing a bit of configuration.

This keeps Mongrel light and lets people extend it for their own needs.
There's already people using GemPlugins to implement management commands
through Capistrano, security enhancements, and monitoring for Mongrel.

So, if you're feeling DIY then first read this:

  http://mongrel.rubyforge.org/docs/gem_plugin.html

Which will get you started with the actual plugin.  Then read the
Mongrel::Configurator.uri and Mongrel::Configurator.plugin documentation:

  http://mongrel.rubyforge.org/rdoc/index.html

You write the Handler slightly different when you do it as a GemPlugin:

  class XmlRpcHandler < GemPlugin::Plugin "/handlers"
    include Mongrel::HttpHandlerPlugin
  end

Everything else is the same as with plain HttpHandler.

Once you have your plugin written, install it like a normal gem and then go
to your Rails app directory.  In there write a config/mongrel.conf file.
This will actually be a Ruby file but we name it .conf so Rails doesn't try
to load it.

This mongrel.conf file acts like it's a chunk of code run inside the
mongrel_rails boot process (inside Configurator).  In your case you'd have
something like this:

  uri "/myxmlrpcthing", :handler => plugin("/handlers/toby::xmlrpchandler",
:op1 => true)

Your handler's init.rb file should load any of the libraries it needs and it
should use the GemPlugin configuration and resource loading to do any extra
configs.

Finally, you load this mongrel.conf file with:

  mongrel_rails start -S config/mongrel.conf

And your handler gets loaded and attached to /myxmlrpcthing with op1 =>
true.

Now, if you don't want to run rails you'll just write either your own
starter script using Mongrel::Configurator or add a command plugin (seen the
above docs for an example) so people can run it manually. Take a look at the
mongrel_rails source to get inspiration.

And that's about it.  Let me know if you hit problems and I'll help you out.
It'll be a good test of how easy this is and help me write the docs.

Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/


On 4/4/06 8:12 AM, "Toby DiPasquale" <toby / cbcg.net> wrote:

> Zed Shaw wrote:
>> This is the Iron Mongrel release.  It is the result of trying to trash
>> Mongrel until it can't move and then fixing anything that comes up.  The
>> work was done on EastMedia's and VeriSign's upcoming project in order to
>> make sure it can handle heavy loads and potentially malformed requests.
>> The
>> project is a security and identity project so having a web server that
>> is
>> able to block bad requests is very important.
> 
> Any plans for an Mongrel XML-RPC hook, a la XMLRPC::WEBrickServlet? I
> didn't see any other than what comes with ActionWebService. I am using
> XML-RPC with WEBrick now and I'd love to move off of it and onto
> Mongrel. Would you accept a patch if submitted?
> 
> --
> Toby DiPasquale