XML-RPC

Solution provided in FAQ is wrong: How to I get the clients IP address in a handler?

Created: 25/Jul/08 04:40 AM   Updated: 28/Nov/08 08:53 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.1

Time Tracking:
Not Specified

Resolution Date: 05/Aug/08 01:35 PM


 Description  « Hide
The code provided in the "How to I get the clients IP address in a handler?" does not work. Specifically, the override of method newPropertyHandlerMapping(URL url) attempts to set a customized RequestSpecificProcessorFactoryFactory class but it does so too late for it to have any effect.

A correct (and cleaner) solution is to make use of the XmlRpcServlet.setRequestProcessorFactoryFactory() method which is intended for this purpose. This can be done in the constructor of the derived class. E.g.,:

public class MyXmlRpcServlet extends XmlRpcServlet
{
public MyXmlRpcServlet()
{
RequestProcessorFactoryFactory factory = new RequestSpecificProcessorFactoryFactory()
{
protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException
{
.
.
.
}
};

setRequestProcessorFactoryFactory(factory);
}
.
.
.
}

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jochen Wiedmann added a comment - 25/Jul/08 09:57 AM
Could you provide a formal patch against faq.fml?

Jochen Wiedmann added a comment - 05/Aug/08 01:35 PM
Thanks. In the end, I choosed a simpler solution, based on a ThreadLocal.

Jochen Wiedmann added a comment - 28/Nov/08 08:53 PM
Closing issues which have been released.