Details
Description
Below is a verbatim copy of an email I've sent to the xmlrpc-dev mailing list:
The FAQ as currently hosted at http://ws.apache.org/xmlrpc/faq.html
has an incorrect answer for server question 4: "How to I get the clients IP
address in a handler?" with respect to WS-XMLRPC 3.1.
The recommended solution is to override newPropertyHandlerMapping() in
XmlRpcServlet-derived subclasses, as follows:
protected PropertyHandlerMapping newPropertyHandlerMapping(URL url)
throws IOException, XmlRpcException
{
PropertyHandlerMapping mapping = super.newPropertyHandlerMapping(url);
RequestProcessorFactoryFactory factory =
new RequestSpecificProcessorFactoryFactory() {
protected Object getRequestProcessor(Class pClass,
XmlRpcRequest pRequest) throws XmlRpcException
};
mapping.setRequestProcessorFactoryFactory(factory);
return mapping;
}
However, this does not work because (as I found out after several hours' worth
of digging through the code) the reflexive handler mapping is established
during the call to super.newPropertyHandlerMapping(), when the new factory is
not yet set up.
The solution is to re-establish the mappings after setting up the custom
request processor factory factory, by adding the following before
the return statement:
mapping.load(Thread.currentThread().getContextClassLoader(), url);
I would be grateful if the FAQ gets updated, so that other people can
avoid the confusion I'd stumbled over.
— end of mail —
However, it is uncertain whether it is actually a bug in the FAQ or elsewhere.