Hi.

I'm having some trouble figuring out what I'm supposed to do to convert my existing XML-RPC 2.0 code to support version 3.0.

Stripping a lot of detail out of the class, my 2.0 version looks like this:

  public class MyEmbeddedWebServer implements Startable {
    private WebServer server;
    private Registry registry;

    // Registry actually passed in by PicoContainer.
    public MyEmbeddedWebServer(Registry registry) {
      this.registry = registry;
    }

    public synchronized start() {
      if (server == null) {
        server = new WebServer(8080);
        server.addHandler(Registry.class.getName(), registry);
        server.start();
      }
    }

    public synchronized stop() {
      if (server != null) {
        server.shutdown();
        server = null;
      }
    }
  }

My problem is that under 3.0, WebServer#addHandler has been removed. As far as I can tell, I'm now supposed to modify the handlers by using something like this:

  PropertyHandlerMapping mapping = new PropertyHandlerMapping();
  webServer.getXmlRpcServer().setHandlerMapping(mapping)

My problem now is that PropertyHandlerMapping#addMapping requires a class. Actually, "Registry" is an interface and the actual class it happens to be depends on what was set into this PicoContainer. And I can't come up with some way to make passing in a class work without using some kind of dodgy hack where I put something into a static ThreadLocal and then have the constructor pull it back out.

Is there a way to get the older and simpler behaviour where I can just pass in an object?

Daniel



--
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/                        Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to