axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Jayasekara <ami...@wso2.com>
Subject [Rampart] Best way to get policy namespace from a message context
Date Fri, 04 Feb 2011 04:56:56 GMT
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


Mime
View raw message