Java Code Examples for org.apache.cxf.helpers.DOMUtils#readXml()

The following examples show how to use org.apache.cxf.helpers.DOMUtils#readXml() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSTSClient.java    From steady with Apache License 2.0 6 votes vote down vote up
protected Element getDelegationSecurityToken(Object delegationObject) throws Exception {
    if (delegationObject != null) {
        final boolean isString = delegationObject instanceof String;
        final boolean isElement = delegationObject instanceof Element; 
        final boolean isCallbackHandler = delegationObject instanceof CallbackHandler;
        if (isString || isElement || isCallbackHandler) {
            if (isString) {
                final Document doc =
                    DOMUtils.readXml(new StringReader((String) delegationObject));
                return doc.getDocumentElement();
            } else if (isElement) {
                return (Element) delegationObject;
            } else {
                DelegationCallback callback = new DelegationCallback(message);
                ((CallbackHandler)delegationObject).handle(new Callback[]{callback});
                return callback.getToken();
            }
        }
    }
    return null;
}
 
Example 2
Source File: AbstractSTSClient.java    From steady with Apache License 2.0 6 votes vote down vote up
protected Element getDelegationSecurityToken(Object delegationObject) throws Exception {
    if (delegationObject != null) {
        final boolean isString = delegationObject instanceof String;
        final boolean isElement = delegationObject instanceof Element; 
        final boolean isCallbackHandler = delegationObject instanceof CallbackHandler;
        if (isString || isElement || isCallbackHandler) {
            if (isString) {
                final Document doc =
                    DOMUtils.readXml(new StringReader((String) delegationObject));
                return doc.getDocumentElement();
            } else if (isElement) {
                return (Element) delegationObject;
            } else {
                DelegationCallback callback = new DelegationCallback(message);
                ((CallbackHandler)delegationObject).handle(new Callback[]{callback});
                return callback.getToken();
            }
        }
    }
    return null;
}
 
Example 3
Source File: AbstractSTSClient.java    From steady with Apache License 2.0 6 votes vote down vote up
protected Element getDelegationSecurityToken(Object delegationObject) throws Exception {
    if (delegationObject != null) {
        final boolean isString = delegationObject instanceof String;
        final boolean isElement = delegationObject instanceof Element; 
        final boolean isCallbackHandler = delegationObject instanceof CallbackHandler;
        if (isString || isElement || isCallbackHandler) {
            if (isString) {
                final Document doc =
                    DOMUtils.readXml(new StringReader((String) delegationObject));
                return doc.getDocumentElement();
            } else if (isElement) {
                return (Element) delegationObject;
            } else {
                DelegationCallback callback = new DelegationCallback(message);
                ((CallbackHandler)delegationObject).handle(new Callback[]{callback});
                return callback.getToken();
            }
        }
    }
    return null;
}
 
Example 4
Source File: AbstractSTSClient.java    From steady with Apache License 2.0 6 votes vote down vote up
protected Element getDelegationSecurityToken(Object delegationObject) throws Exception {
    if (delegationObject != null) {
        final boolean isString = delegationObject instanceof String;
        final boolean isElement = delegationObject instanceof Element; 
        final boolean isCallbackHandler = delegationObject instanceof CallbackHandler;
        if (isString || isElement || isCallbackHandler) {
            if (isString) {
                final Document doc =
                    DOMUtils.readXml(new StringReader((String) delegationObject));
                return doc.getDocumentElement();
            } else if (isElement) {
                return (Element) delegationObject;
            } else {
                DelegationCallback callback = new DelegationCallback(message);
                ((CallbackHandler)delegationObject).handle(new Callback[]{callback});
                return callback.getToken();
            }
        }
    }
    return null;
}
 
Example 5
Source File: AbstractSecurityTest.java    From steady with Apache License 2.0 4 votes vote down vote up
/**
 * Reads a classpath resource into a Document.
 * @param name the name of the classpath resource
 */
protected Document readDocument(String name) throws SAXException, IOException,
    ParserConfigurationException {
    InputStream inStream = getClass().getResourceAsStream(name);
    return DOMUtils.readXml(inStream);
}
 
Example 6
Source File: AbstractSecurityTest.java    From steady with Apache License 2.0 4 votes vote down vote up
/**
 * Reads a classpath resource into a Document.
 * @param name the name of the classpath resource
 */
protected Document readDocument(String name) throws SAXException, IOException,
    ParserConfigurationException {
    InputStream inStream = getClass().getResourceAsStream(name);
    return DOMUtils.readXml(inStream);
}
 
Example 7
Source File: AbstractSecurityTest.java    From steady with Apache License 2.0 4 votes vote down vote up
/**
 * Reads a classpath resource into a Document.
 * @param name the name of the classpath resource
 */
protected Document readDocument(String name) throws SAXException, IOException,
    ParserConfigurationException {
    InputStream inStream = getClass().getResourceAsStream(name);
    return DOMUtils.readXml(inStream);
}
 
Example 8
Source File: AbstractSecurityTest.java    From steady with Apache License 2.0 4 votes vote down vote up
/**
 * Reads a classpath resource into a Document.
 * @param name the name of the classpath resource
 */
protected Document readDocument(String name) throws SAXException, IOException,
    ParserConfigurationException {
    InputStream inStream = getClass().getResourceAsStream(name);
    return DOMUtils.readXml(inStream);
}