xml-rpc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: WebServer.java
Date Thu, 15 Aug 2002 16:38:49 GMT
Adam Megacz <adam@megacz.com> writes:

> "Rob Walker" <robw@softsell.com> writes:
> > Interestingly we've done this for Osgi (the open source Oscar 
> > implementation) - by providing a Servlet bridge from the xml/rpc handlers 
> > through to Jetty as the HttpServer (which is itself wrappered to provide a 
> > standard OSGi HttpService).
> 
> Is there a way to design this adapte such that XMLL-RPC handler
> mappings are configurable from the web.xml file like servlets?
> 
> Ideally, you'd be able to do stuff like
> 
>     <xml-rpc>
>         <xml-rpc-name> Foo </xml-rpc-name>
>         <handler-class> org.xwt.foo.bar </handler-class>
>         <mount-point> foo.bar </mount-point>
>     </xml-rpc>

With Servlet API 2.2+, you could use servlet initialization parameters
to accomplish this:

    <servlet>
        <servlet-name>RPC2</servlet-name>
        <servlet-class>
          org.apache.xmlrpc.XmlRpcServlet
        </servlet-class>
        <init-param>
            <param-name>handler.Foo</param-name>
            <param-value>org.xwt.foo.bar</param-value>
        </init-param>
    </servlet>

Using the above config, XmlRpcServlet would grab its list of
initialization parameters and search for those prefixed with
"handler.", stripping the prefix and using the value as class name.
Since XmlRpcServer uses reflection to invoke its handlers, Your
example's <mount-point> element isn't relevant unless you want to use
an alternate name to invoke a defined method of your class.

Alternately, you could also pass your above snippet of XML in a CDATA
block _inside_ the <param-value> for a more XML-ish style of
configuration.

Random note: JServ supported a similar functionality for Servlet API
2.0.
-- 

Daniel Rall <dlr@finemaltcoding.com>

Mime
View raw message