ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Duclos" <>
Subject Re: Access Response object in Handler?
Date Wed, 20 Nov 2002 16:42:18 GMT

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
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" <>
To: <>
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
> 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 =
> But now i'm in the handler in the "doLogin()" method. I can't see how i
> 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

View raw message