You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Amila Jayasekara <am...@wso2.com> on 2011/02/04 05:56:56 UTC

[Rampart] Best way to get policy namespace from a message context

Hi All,
What is the best possible method to get policy namespace, given a
message context. Currently i am doing following,

//Get policy from messageContext
Policy servicePolicy = (Policy)msgCtx.getProperty(KEY_RAMPART_POLICY);

//Get the policy alternative
List assertionList = (List)servicePolicy.getAlternatives().next();

//Iterate through policy assertion list
for (Object anAssertionList : assertionList) {

            Assertion assertionObject = (Assertion) anAssertionList;

            //If assertion is not a RampartConfig get the policy
namespace from the assertion

            if (!(assertionObject instanceof RampartConfig)) {
                String policyNS = assertionObject.getName().getNamespaceURI();
                break;
             }
}

If there is a better way to do this, please let me know.

Thanks
AmilaJ

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org