I am attempting to upgrade my app from xml-rpc 2.x to xml-rpc 3.

My app executes in a servlet env.  I am unable to figure out how to
get the httpSession to the handler.

Tried to implement the code in http://ws.apache.org/xmlrpc/faq.html#client_ip
since getting the IP Address  and getting the session are similiar.

The code in this example doesn't compile.


mapping.setRequestProcessorFactoryFactory(mapping);


should probably be:


mapping.setRequestProcessorFactoryFactory(factory);


I got beyond that point after a bit of head scratching, I created the appropriate interface (RequestInitProcessor) and a class to hold the data (XmlSessionConfig) but now, the method overridden in MyServlet


RequestSpecificProcessorFactoryFactory(){
protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException{ RequestInitProcessor proc = (RequestInitProcessor) super.getRequestProcessor(pClass, pRequest);
      proc.init((XmlSessionConfig)pRequest.getConfig());
      return proc;
  }


is never called.

What I found was that the default RequestSpecificProcessorFactoryFactory
was being called not the overridden one. I thought it might have to do with
the fact that RequestProcessorFactoryFactory is a static class (grasping at straws).

After looking through the source code/javadocs, there is a comment about
creating your own RequestSpecificProcessorFactoryFactory class. So my override in
MyServlet looks like the following:

protected PropertyHandlerMapping newPropertyHandlerMapping(URL url) throws IOException, XmlRpcException { PropertyHandlerMapping mapping = super.newPropertyHandlerMapping(url); RequestProcessorFactoryFactory factory = new SessionRequestProcessorFactoryFactory();
      /*
RequestProcessorFactoryFactory factory = new RequestSpecificProcessorFactoryFactory(){ protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException{ RequestInitProcessor proc = (RequestInitProcessor) super.getRequestProcessor(pClass, pRequest);
              proc.init((XmlSessionConfig)pRequest.getConfig());
              return proc;
          }
      };
      */
      mapping.setRequestProcessorFactoryFactory(factory);
      return mapping;


SessionRequestProcessorFactoryFactory has the required methods and is added to the mapping, but the default RequestProcessor is still being returned.

Anyway, here is the stack after I created my own Processor factory.

Thread [P1-18] (Suspended (breakpoint at line 107 in RequestProcessorFactoryFactory$RequestSpecificProcessorFactoryFactory)) RequestProcessorFactoryFactory$RequestSpecificProcessorFactoryFactory.getRequestProcessor(Class,XmlRpcRequest) RequestProcessorFactoryFactory$RequestSpecificProcessorFactoryFactory$1.getRequestProcessor(XmlRpcRequest) ReflectiveXmlRpcMetaDataHandler(ReflectiveXmlRpcHandler).getInstance(XmlRpcRequest) ReflectiveXmlRpcMetaDataHandler(ReflectiveXmlRpcHandler).execute(XmlRpcRequest)
  XmlRpcServerWorker.execute(XmlRpcRequest)
  MyServlet$1(XmlRpcServer).execute(XmlRpcRequest)
MyServlet$1(XmlRpcStreamServer).execute(XmlRpcStreamRequestConfig, ServerStreamConnection) MyServlet$1(XmlRpcServletServer).execute(HttpServletRequest, HttpServletResponse) MyServlet(XmlRpcServlet).doPost(HttpServletRequest, HttpServletResponse)
I would have suspected the first two lines to be:

MyRequestProcessorFactoryFactory.getRequestProcessor(Class, XmlRpcRequest)
  MyRequestProcessorFactoryFactory.getRequestProcessor(XmlRpcRequest)


How does a user defined XXXProcessorFactoryFactory get from the mapping - to the handler? I see my factory in the mapping (in XmlRpcServerWorker.execute()) but I don't see how it's
added to the handler, so the handler simply gets the default factory.


Could anyone explain how this is suppose to work.


Also, could someone post an example servlet where overriding the requestProcessor works?

Thanks
Mike Shillinger


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to