ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jimisola Laursen <li...@jimisola.com>
Subject RE: HandlerMapping problem (3.0b1 to 3.0rc1)
Date Tue, 22 Aug 2006 09:41:58 GMT

Please note that I actually haven't had time to test the code below yet
because I am still working on the protocol between server and client, but I
believe that this is the way to do it.

E.g.:

public class MyProcessorFactoryFactory extends
StatelessProcessorFactoryFactory
{
    private DataSource dataSource;

    public AgentRPCProcessorFactoryFactory(DataSource dataSource)
    {
        super();
        this.dataSource = dataSource;
    }

    protected Object getRequestProcessor(Class pClass) throws
XmlRpcException
    {
        Object result = super.getRequestProcessor(pClass);

        // initialize request processors

        if (result instanceof MyRPCImpl) // I use a Proxy solution
        {
            AgentRPCImpl agentRPCImpl = (AgentRPCImpl) result;
            agentRPCImpl.init(this.dataSource);
        }

        return result;
    }
}




Bellekens, P.A.E. wrote:
> 
> Hi Jmisola,
> 
> Thanks for your reply!
> But I must say that I still do not completely understand these
> constructs.
> 
> If I instantiate my HandlerMapping as follows:
> 
> PropertyHandlerMapping dhm = new PropertyHandlerMapping();
> dhm.addHandler("Box", XMLRpcMethodForwarder.class);
> dhm.setRequestProcessorFactoryFactory(new
> MyRequestProcessorFactoryFactory());
> 
> with the factory extension (just like described in the API):
> 
> public class MyRequestProcessorFactoryFactory extends
> RequestSpecificProcessorFactoryFactory {
> 		
> protected Object getRequestProcessor(Class pClass, XmlRpcRequest
> pRequest) {
> 	Object result = null;
> 	System.out.println("test1");
> 	try {
> 		result = super.getRequestProcessor(pClass, pRequest);
> 		System.out.println(pClass+" - "+pRequest);
> 	} catch (XmlRpcException e) {
> 		// TODO Auto-generated catch block
> 		e.printStackTrace();
> 	}
> 	// Configure the object here
> 	//...
> 	return result;
> }
> 
> What does this help me?
> First of all when I compile this code and fire some client requests, the
> printout "test1" is never shown while the API doc says:
> 
> "A new instance is created and initialized for any request"
> 
> And secondly, what can I configure here? The "getRequestProcessor"
> method returns an object, not much you can do with that...
> 
> Can somebody maybe explain how I can feed the class with a parameter? 
> 
> Greetz
> p.
> 
> 
> -----Original Message-----
> From: Jimisola Laursen [mailto:lists@jimisola.com] 
> Sent: dinsdag 22 augustus 2006 1:23
> To: xmlrpc-user@ws.apache.org
> Subject: Re: HandlerMapping problem (3.0b1 to 3.0rc1)
> 
> 
> Hi!
> 
> Have a look at the different RequestProcessorFactory (sub)classes:
> 
> http://ws.apache.org/xmlrpc/apidocs/org/apache/xmlrpc/server/RequestProc
> essorFactoryFactory.html
> 
> Regards,
> Jimisola
> 
> -- 
> View this message in context:
> http://www.nabble.com/From-DynamicHandlerMapping-to-----%283.0b1-to-3.0r
> c1%29-tf2036402.html#a5916882
> Sent from the Apache Xml-RPC - User forum at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xmlrpc-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: xmlrpc-user-help@ws.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xmlrpc-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: xmlrpc-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/From-DynamicHandlerMapping-to-----%283.0b1-to-3.0rc1%29-tf2036402.html#a5922360
Sent from the Apache Xml-RPC - User forum at Nabble.com.


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


Mime
View raw message