We'll that will save me some time.. I was just about the test a POJOComand
trying to access the MessageContext with init.

However, I'm now I confused. In the prior POST you mentioned:

"So if you have them in the message as properties, then you could use a
pojoCommand mediator [1] and use the expression attrbiute to specify an
xpath to extract the values stored in the message. If that is stored as a
property in the message context you could user the get-property function by
passing the property name as the expression. "

This is from the "Java Class Properties Setting" posts...

The issue was changing the username and password per message for a mediator
that adds these to the Transport Header, see java attached. 

http://www.nabble.com/file/p22448842/CreateBasicAuthMediator.java
CreateBasicAuthMediator.java 

I believe it was suggested that I convert this from a Class Mediator to a
POJOCommand.
How can I pass different property values, per message, to some Java code
that can access the MessageContext ?

So in the above I would need to pass different username and passwords for
different users but these values are set elsewhere in the script. The
original issue was how to pass property value based on an XPath to Class,
and it was agreed this could not be done.




Ruwan Linton wrote:
> 
> Hi Kim,
> 
> You cannot get the messageContext into the POJOCommand mediator, and it
> doesn't support the init method as well.
> 
> You have the access to the message context through the properties because
> it
> always set and get the properties from the current message, you can use
> the
> UpdateMessage action with a xpath expression to update the message with
> the
> out put from the POJO.
> 
> Thanks,
> Ruwan
> 
> On Tue, Mar 10, 2009 at 7:17 AM, kimhorn <[email protected]> wrote:
> 
>>
>>
>> Should / Can the POJO implement ManagedLifecycle to get the Synapse
>> Environment to get the
>> MesageContext?
>>
>>
>>
>> kimhorn wrote:
>> >
>> > Does any one have a Java example of a POJOCommand that uses Message
>> > Context.
>> > Unclear how you access it from execute method ?
>> >
>> > Background to this is in "Java Class Properties Setting" item,
>> including
>> > the Java
>> > code.
>> >
>> > Basically it was recomended to convert this from a Mediator to a POJO
>> but
>> > not
>> > sure it can be done ?
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Accessing-Message-Context-in-POJOCommand-tp22425548p22426517.html
>> Sent from the Synapse - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Ruwan Linton
> Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: [email protected]; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Accessing-Message-Context-in-POJOCommand-tp22425548p22448842.html
Sent from the Synapse - User mailing list archive at Nabble.com.

Reply via email to