You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by arvind krishna <ar...@yahoo.co.uk> on 2008/05/13 19:27:09 UTC

Newbie: Question regarding Property Handler mapping

Hi,

I am running some simple XML-RPC examples using Apache
and have a question related to property handlers. From
my examples, I noticed that a new handler is created
for every request invocation. 

For example if I have class Handler with two methods
foo and bar

Handler {
   bool foo ();
   bool bar ();
}

and install the handler as follows:

phm.addHandler ("test", Handler.class);

When the client invokes foo multiple times, a new
instance of Handler is created each time. 

My questions: (1) is there a way to avoid this
behavior? i.e, not create a new handler each time (2)
is there a way to pre-create the handler and add it to
the property handler?

Thanks,
Arvind



      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

Re: Newbie: Question regarding Property Handler mapping

Posted by Daniel Noll <da...@nuix.com>.
On Wednesday 14 May 2008 03:27:09 arvind krishna wrote:
> My questions: (1) is there a way to avoid this
> behavior? i.e, not create a new handler each time (2)
> is there a way to pre-create the handler and add it to
> the property handler?

There was a really easy way to do this before version 2.0 as I remember it.

Now I suspect you have no choice but to override 
XmlRpcServlet.newXmlRpcHandlerMapping, and return a custom mapping which 
returns your fixed objects.

The other approach is to create some handlers which delegate to the real ones 
such that creating a new one each time doesn't affect the way it works.

Daniel