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 ka...@web.de on 2006/11/30 16:53:46 UTC

Problem with HandlerMapping, custom RequestProcessorFactoryFactory not called : FAQ hint with bug?

Hi,

after studying the api and the faq entry about initializing a request processor with some state (in this case the HttpServletRequest) i found similar hints to solve the problem:

Servlet:
1. overwriting "newXmlRpcServer" to save the request i a helper object

	protected XmlRpcServletServer newXmlRpcServer(ServletConfig pConfig)
	throws XmlRpcException {
		return new XmlRpcServletServer(){
			protected XmlRpcHttpRequestConfigImpl newConfig(HttpServletRequest pRequest) {
				MyContext context = new MyContext();
				context.setRequest(pRequest);
				return context;
			}
		};
	}

2. overwriting "newPropertyHandlerMapping" to do the mapping
        PropertyHandlerMapping mapping = new PropertyHandlerMapping();
        MyProcessorFactoryFactory factory = new MyProcessorFactoryFactory(new MDBServiceContext());
        mapping.addHandler("Search", SearchWSManager.class);
        mapping.setRequestProcessorFactoryFactory(factory);
        ...


3. Custom ProcessorFactoryFactory
public class MyProcessorFactoryFactory extends
		StatelessProcessorFactoryFactory {
	private MyContext serviceContext;

	public MyProcessorFactoryFactory(MyContext serviceContext) {
		super();
		this.serviceContext = serviceContext;
	}
	
	protected Object getRequestProcessor(Class pClass) throws XmlRpcException{
        RequestInitializableRequestProcessor proc =
            (RequestInitializableRequestProcessor) super.getRequestProcessor(pClass);
        proc.init(this.serviceContext);
        return proc;
    }
}

But: This custom getRequestProcessor Method is never called, so the Request Processor is never initialized as i want to.

So: It seems possible to register custom RequestProcessorFactories, but i'm not able to figure that out. And the sample in the faq is not very helpful because it is even not compiling...

Some help?

Best Regards,

Tom
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066


---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org