Hi, This is probably not the most elegant of solutions, but it works. The way I accomplished this was by not registering the handler in the init() method of the servlet, but instead, the doPost method.
In the doPost method, you first register the handler (passing the response object to the constructor). Next execute the xmlrpc method as you normally would. Third remove the handler. xmlrpc.addHandler( "whatever", new ManipulateResponse( response ) ); byte[] result = xmlrpc.execute (request.getInputStream ()); xmlrpc.removeHandler( "whatever" ); This way you have a new handler for each new request with their appropriate response object. And obviously you will also need to synchronize this block so your threads don't overlap each other. This method works pretty well for me and has not caused any issues, but I would test thoroughly if going into a production environment. Hope this helps you out. Scott Duclos ----- Original Message ----- From: "Twan Kogels" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 20, 2002 11:14 AM Subject: Access Response object in Handler? > Hello, > > I've got a problem and can't seem to find the answer. I've made a > midp(j2me) client which communicates with a xml-rpc server (in java, as > servlet). No problem here. > > A clients wants to login, easy peasy, check the username en password in a > methode "doLogin" in class "Login". Add a handler and ready. Works perfect, > doLogin() gets executed when a xml-rpc message comes in. > > But now i want to return the url of the servlet in the doLogin() methode. > When i'm in the servlet doPost methode it's easy: > String sessionURL = response.encodeURL(request.getRequestURL().toString()); > But now i'm in the handler in the "doLogin()" method. I can't see how i can > access the Response object. > > I can't pass it in the constructor when i add the handlers, cause the > Response object is not available in the init() methode of servlet. I also > can't seem to pass a extra parameter to the execute() methode. > > I'm quite stuck. Can anybody offer me a helping hand? > > Best regards, > Twan Kogels > >
