Code example for Node

Methods: getNamespaceURI

0
     * @return <code>AbstractRequestCtx</code> object 
     * @throws org.wso2.balana.ParsingException  if the DOM node is invalid 
     */ 
    public AbstractRequestCtx getRequestCtx(Node root) throws ParsingException {
 
        String requestCtxNs = root.getNamespaceURI();
 
        if(requestCtxNs != null){
            if(XACMLConstants.REQUEST_CONTEXT_3_0_IDENTIFIER.equals(requestCtxNs.trim())){
                return RequestCtx.getInstance(root);
            } else if(XACMLConstants.REQUEST_CONTEXT_1_0_IDENTIFIER.equals(requestCtxNs.trim()) ||
                    XACMLConstants.REQUEST_CONTEXT_2_0_IDENTIFIER.equals(requestCtxNs.trim())) {
                return org.wso2.balana.ctx.xacml2.RequestCtx.getInstance(root);
            } else { 
                throw new ParsingException("Invalid namespace in XACML request"); 
            } 
        } else { 
            log.warn("No Namespace defined in XACML request and Assume as XACML 3.0");
            return RequestCtx.getInstance(root);
        } 
    } 
 
    /** 
     *  Returns instance of <code>AbstractRequestCtx</code> based one the XACML version.