/** * Clone an XMLObject by brute force: * * <p> * 1) Marshall the original object if necessary * 2) Clone the resulting DOM Element * 3) Unmarshall a new XMLObject tree around it. * </p> * * <p> * This method variant is equivalent to <code>cloneXMLObject(originalXMLObject, false).</code> * </p> * * * @param originalXMLObject the object to be cloned * @return a clone of the original object * * @throws MarshallingException if original object can not be marshalled * @throws UnmarshallingException if cloned object tree can not be unmarshalled * * @param <T> the type of object being cloned */ public static <T extends XMLObject> T cloneXMLObject(T originalXMLObject) throws MarshallingException, UnmarshallingException { return cloneXMLObject(originalXMLObject, false); }
/** * Marshall an XMLObject to a Writer. * * @param xmlObject the XMLObject to marshall * @param writer the Writer to which to marshall * @throws MarshallingException if there is a problem marshalling the object */ public static void marshallToWriter(XMLObject xmlObject, Writer writer) throws MarshallingException { Element element = marshall(xmlObject); XMLHelper.writeNode(element, writer); }
Logger log = getLogger(); log.debug("Marshalling XMLObject");
String nsURI = XMLObjectHelper.lookupNamespaceURI(attributeOwner, candidatePrefix); log.trace("Resolved namespace URI '{}'", nsURI); if (nsURI != null) {
StringWriter writer = new StringWriter(); try { XMLObjectHelper.marshallToWriter(message, writer); } catch (MarshallingException e) { throw new XMLRuntimeException("Error marshalling the SAMLObject: " + e.getMessage());
SAMLObject samlObject = (SAMLObject) XMLObjectHelper.unmarshallFromReader(parserPool, reader); message = samlObject; } catch (XMLParserException e) {
Logger log = getLogger(); log.debug("Parsing InputStream into DOM document");
String nsURI = XMLObjectHelper.lookupNamespaceURI(attributeOwner, candidatePrefix); log.trace("Resolved namespace URI '{}'", nsURI); if (nsURI != null) {
/** * Clone an XMLObject by brute force: * * <p> * 1) Marshall the original object if necessary * 2) Clone the resulting DOM Element * 3) Unmarshall a new XMLObject tree around it. * </p> * * <p> * This method variant is equivalent to <code>cloneXMLObject(originalXMLObject, false).</code> * </p> * * * @param originalXMLObject the object to be cloned * @return a clone of the original object * * @throws MarshallingException if original object can not be marshalled * @throws UnmarshallingException if cloned object tree can not be unmarshalled * * @param <T> the type of object being cloned */ public static <T extends XMLObject> T cloneXMLObject(T originalXMLObject) throws MarshallingException, UnmarshallingException { return cloneXMLObject(originalXMLObject, false); }
Logger log = getLogger(); log.debug("Parsing Reader into DOM document");
/** * Marshall an XMLObject to a Writer. * * @param xmlObject the XMLObject to marshall * @param writer the Writer to which to marshall * @throws MarshallingException if there is a problem marshalling the object */ public static void marshallToWriter(XMLObject xmlObject, Writer writer) throws MarshallingException { Element element = marshall(xmlObject); XMLHelper.writeNode(element, writer); }
/** * Get the SAMLObject which will actually be stored in the produced SAMLArtifactMapEntry. * * <p> * This may or may not be the same SAMLObject that is passed in. If the SAMLObject does * not have a parent, the same object will be returned. Otherwise, the object will be cloned * and the cloned instance returned. * </p> * * @param samlMessage the SAML message to process * @return an equivalent SAML Message */ private SAMLObject getStorableSAMLMessage(SAMLObject samlMessage) { if (!samlMessage.hasParent()) { return samlMessage; } else { try { return XMLObjectHelper.cloneXMLObject(samlMessage, true); } catch (MarshallingException e) { throw new XMLRuntimeException("Error during marshalling of SAMLObject", e); } catch (UnmarshallingException e) { throw new XMLRuntimeException("Error during unmarshalling of SAMLObject", e); } } }
Logger log = getLogger(); log.debug("Marshalling XMLObject");
/** * Marshall an XMLObject to an OutputStream. * * @param xmlObject the XMLObject to marshall * @param outputStream the OutputStream to which to marshall * @throws MarshallingException if there is a problem marshalling the object */ public static void marshallToOutputStream(XMLObject xmlObject, OutputStream outputStream) throws MarshallingException { Element element = marshall(xmlObject); XMLHelper.writeNode(element, outputStream); }
Logger log = getLogger(); log.debug("Parsing InputStream into DOM document");
/** * Marshall an XMLObject to an OutputStream. * * @param xmlObject the XMLObject to marshall * @param outputStream the OutputStream to which to marshall * @throws MarshallingException if there is a problem marshalling the object */ public static void marshallToOutputStream(XMLObject xmlObject, OutputStream outputStream) throws MarshallingException { Element element = marshall(xmlObject); XMLHelper.writeNode(element, outputStream); }
Logger log = getLogger(); log.debug("Parsing Reader into DOM document");