axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantinos Margaritis <mar...@debian.gr>
Subject Re: How do I pass data from Handler to the service?
Date Sun, 23 May 2004 16:50:00 GMT
This worked PERFECTLY! Thanks! Short, Clean and exactly what I wanted! 
Thanks a lot!

Konstantinos

On Thursday 20 May 2004 23:38, Nelson Minar wrote:
> 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