axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nelson Minar <nel...@monkey.org>
Subject Re: How do I pass data from Handler to the service?
Date Thu, 20 May 2004 20:38:24 GMT
Argh! Don't use system properties, or ThreadLocals, or the like.

>> I suggest having the Handler store the data in the Axis
>> MessageContext, then read it back out in the Service. 
>Can you give me an example?

In your Handler:

public void invoke(MessageContext context) throws AxisFault {
  Object data = ...;
  context.setProperty("MyData", data);
}

In your service method:

public foo myService(int a, String b) {
  MessageContext context = MessageContext.getCurrentContext();
  Object data = context.getProperty("MyData");
}


Underneath the scenes MessageContext.getCurrentContext() is actually
using a ThreadLocal to do things. But let Axis do that itself, no need
to do your own.

Mime
View raw message