Uploaded image for project: 'XML-RPC'
  1. XML-RPC
  2. XMLRPC-158

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.1.1
    • None
    • None

    Description

      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);
      }
      .
      .
      .
      }

      Attachments

        Activity

          People

            jochen@apache.org Jochen Wiedmann
            faseidl F. Andy Seidl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: