< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPPartImpl.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 23,55 **** * questions. */ package com.sun.xml.internal.messaging.saaj.soap; - import java.io.*; - import java.util.Iterator; - import java.util.logging.Logger; - import java.util.logging.Level; - - import javax.activation.DataHandler; - import javax.activation.DataSource; - import javax.xml.soap.*; - import javax.xml.transform.Source; - import javax.xml.transform.stream.StreamSource; - - import org.w3c.dom.*; - - import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart; - import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl; import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; ! import com.sun.xml.internal.messaging.saaj.util.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; /** * SOAPPartImpl is the first attachment. This contains the XML/SOAP document. * * @author Anil Vijendran (anil@sun.com) --- 23,82 ---- * questions. */ package com.sun.xml.internal.messaging.saaj.soap; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; + import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart; import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl; import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; ! import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; ! import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; ! import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection; ! import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource; ! import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; ! import com.sun.xml.internal.messaging.saaj.util.MimeHeadersUtil; ! import com.sun.xml.internal.messaging.saaj.util.SAAJUtil; ! import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser; ! import org.w3c.dom.Attr; ! import org.w3c.dom.CDATASection; ! import org.w3c.dom.Comment; ! import org.w3c.dom.DOMConfiguration; ! import org.w3c.dom.DOMException; ! import org.w3c.dom.DOMImplementation; ! import org.w3c.dom.Document; ! import org.w3c.dom.DocumentFragment; ! import org.w3c.dom.DocumentType; ! import org.w3c.dom.Element; ! import org.w3c.dom.EntityReference; ! import org.w3c.dom.NamedNodeMap; ! import org.w3c.dom.NodeList; ! import org.w3c.dom.ProcessingInstruction; ! import org.w3c.dom.UserDataHandler; + import javax.activation.DataHandler; + import javax.activation.DataSource; + import javax.xml.soap.MimeHeaders; + import javax.xml.soap.SOAPElement; + import javax.xml.soap.SOAPEnvelope; + import javax.xml.soap.SOAPException; + import javax.xml.soap.SOAPPart; + import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; + import javax.xml.transform.stream.StreamSource; + import java.io.IOException; + import java.io.InputStream; + import java.io.InputStreamReader; + import java.io.OutputStream; + import java.io.PushbackReader; + import java.io.Reader; + import java.io.UnsupportedEncodingException; + import java.util.Iterator; + import java.util.logging.Level; + import java.util.logging.Logger; /** * SOAPPartImpl is the first attachment. This contains the XML/SOAP document. * * @author Anil Vijendran (anil@sun.com)
*** 126,149 **** } } else if (source != null) { envelope = createEnvelopeFromSource(); } else { envelope = createEmptyEnvelope(null); ! document.insertBefore(envelope, null); } return envelope; } protected void lookForEnvelope() throws SOAPException { Element envelopeChildElement = document.doGetDocumentElement(); ! if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) { ! envelope = (EnvelopeImpl) envelopeChildElement; ! } else if (!(envelopeChildElement instanceof ElementImpl)) { log.severe("SAAJ0512.soap.incorrect.factory.used"); throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction"); } else { ! ElementImpl soapElement = (ElementImpl) envelopeChildElement; if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) { String prefix = soapElement.getPrefix(); String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix); if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) { log.severe("SAAJ0513.soap.unknown.ns"); --- 153,177 ---- } } else if (source != null) { envelope = createEnvelopeFromSource(); } else { envelope = createEmptyEnvelope(null); ! document.insertBefore(((EnvelopeImpl) envelope).getDomElement(), null); } return envelope; } protected void lookForEnvelope() throws SOAPException { Element envelopeChildElement = document.doGetDocumentElement(); ! org.w3c.dom.Node soapEnvelope = document.findIfPresent(envelopeChildElement); ! if (soapEnvelope == null || soapEnvelope instanceof Envelope) { ! envelope = (EnvelopeImpl) soapEnvelope; ! } else if (document.find(envelopeChildElement) == null) { log.severe("SAAJ0512.soap.incorrect.factory.used"); throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction"); } else { ! ElementImpl soapElement = (ElementImpl) document.find(envelopeChildElement); if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) { String prefix = soapElement.getPrefix(); String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix); if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) { log.severe("SAAJ0513.soap.unknown.ns");
*** 496,506 **** newSoapPart.source = this.source; return newSoapPart; } public NamedNodeMap getAttributes() { ! return document.getAttributes(); } public NodeList getChildNodes() { handleNewSource(); return document.getChildNodes(); --- 524,534 ---- newSoapPart.source = this.source; return newSoapPart; } public NamedNodeMap getAttributes() { ! return document.getDomDocument().getAttributes(); } public NodeList getChildNodes() { handleNewSource(); return document.getChildNodes();
*** 515,566 **** handleNewSource(); return document.getLastChild(); } public String getLocalName() { ! return document.getLocalName(); } public String getNamespaceURI() { ! return document.getNamespaceURI(); } public org.w3c.dom.Node getNextSibling() { handleNewSource(); return document.getNextSibling(); } public String getNodeName() { ! return document.getNodeName(); } public short getNodeType() { ! return document.getNodeType(); } public String getNodeValue() throws DOMException { return document.getNodeValue(); } public Document getOwnerDocument() { ! return document.getOwnerDocument(); } public org.w3c.dom.Node getParentNode() { ! return document.getParentNode(); } public String getPrefix() { ! return document.getPrefix(); } public org.w3c.dom.Node getPreviousSibling() { ! return document.getPreviousSibling(); } public boolean hasAttributes() { ! return document.hasAttributes(); } public boolean hasChildNodes() { handleNewSource(); return document.hasChildNodes(); --- 543,594 ---- handleNewSource(); return document.getLastChild(); } public String getLocalName() { ! return document.getDomDocument().getLocalName(); } public String getNamespaceURI() { ! return document.getDomDocument().getNamespaceURI(); } public org.w3c.dom.Node getNextSibling() { handleNewSource(); return document.getNextSibling(); } public String getNodeName() { ! return document.getDomDocument().getNodeName(); } public short getNodeType() { ! return document.getDomDocument().getNodeType(); } public String getNodeValue() throws DOMException { return document.getNodeValue(); } public Document getOwnerDocument() { ! return document.getDomDocument().getOwnerDocument(); } public org.w3c.dom.Node getParentNode() { ! return document.getDomDocument().getParentNode(); } public String getPrefix() { ! return document.getDomDocument().getPrefix(); } public org.w3c.dom.Node getPreviousSibling() { ! return document.getDomDocument().getPreviousSibling(); } public boolean hasAttributes() { ! return document.getDomDocument().hasAttributes(); } public boolean hasChildNodes() { handleNewSource(); return document.hasChildNodes();
*** 573,583 **** handleNewSource(); return document.insertBefore(arg0, arg1); } public boolean isSupported(String arg0, String arg1) { ! return document.isSupported(arg0, arg1); } public void normalize() { handleNewSource(); document.normalize(); --- 601,611 ---- handleNewSource(); return document.insertBefore(arg0, arg1); } public boolean isSupported(String arg0, String arg1) { ! return document.getDomDocument().isSupported(arg0, arg1); } public void normalize() { handleNewSource(); document.normalize();
*** 684,694 **** public void normalizeDocument() { document.normalizeDocument(); } public DOMConfiguration getDomConfig() { ! return document.getDomConfig(); } public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException { handleNewSource(); return document.adoptNode(source); --- 712,722 ---- public void normalizeDocument() { document.normalizeDocument(); } public DOMConfiguration getDomConfig() { ! return document.getDomDocument().getDomConfig(); } public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException { handleNewSource(); return document.adoptNode(source);
*** 697,744 **** public void setDocumentURI(String documentURI) { document.setDocumentURI(documentURI); } public String getDocumentURI() { ! return document.getDocumentURI(); } public void setStrictErrorChecking(boolean strictErrorChecking) { document.setStrictErrorChecking(strictErrorChecking); } public String getInputEncoding() { ! return document.getInputEncoding(); } public String getXmlEncoding() { ! return document.getXmlEncoding(); } public boolean getXmlStandalone() { ! return document.getXmlStandalone(); } public void setXmlStandalone(boolean xmlStandalone) throws DOMException { document.setXmlStandalone(xmlStandalone); } public String getXmlVersion() { ! return document.getXmlVersion(); } public void setXmlVersion(String xmlVersion) throws DOMException { document.setXmlVersion(xmlVersion); } public boolean getStrictErrorChecking() { ! return document.getStrictErrorChecking(); } // DOM L3 methods from org.w3c.dom.Node public String getBaseURI() { ! return document.getBaseURI(); } public short compareDocumentPosition(org.w3c.dom.Node other) throws DOMException { return document.compareDocumentPosition(other); --- 725,772 ---- public void setDocumentURI(String documentURI) { document.setDocumentURI(documentURI); } public String getDocumentURI() { ! return document.getDomDocument().getDocumentURI(); } public void setStrictErrorChecking(boolean strictErrorChecking) { document.setStrictErrorChecking(strictErrorChecking); } public String getInputEncoding() { ! return document.getDomDocument().getInputEncoding(); } public String getXmlEncoding() { ! return document.getDomDocument().getXmlEncoding(); } public boolean getXmlStandalone() { ! return document.getDomDocument().getXmlStandalone(); } public void setXmlStandalone(boolean xmlStandalone) throws DOMException { document.setXmlStandalone(xmlStandalone); } public String getXmlVersion() { ! return document.getDomDocument().getXmlVersion(); } public void setXmlVersion(String xmlVersion) throws DOMException { document.setXmlVersion(xmlVersion); } public boolean getStrictErrorChecking() { ! return document.getDomDocument().getStrictErrorChecking(); } // DOM L3 methods from org.w3c.dom.Node public String getBaseURI() { ! return document.getDomDocument().getBaseURI(); } public short compareDocumentPosition(org.w3c.dom.Node other) throws DOMException { return document.compareDocumentPosition(other);
*** 756,766 **** public boolean isSameNode(org.w3c.dom.Node other) { return document.isSameNode(other); } public String lookupPrefix(String namespaceURI) { ! return document.lookupPrefix(namespaceURI); } public boolean isDefaultNamespace(String namespaceURI) { return document.isDefaultNamespace(namespaceURI); } --- 784,794 ---- public boolean isSameNode(org.w3c.dom.Node other) { return document.isSameNode(other); } public String lookupPrefix(String namespaceURI) { ! return document.getDomDocument().lookupPrefix(namespaceURI); } public boolean isDefaultNamespace(String namespaceURI) { return document.isDefaultNamespace(namespaceURI); }
*** 768,778 **** public String lookupNamespaceURI(String prefix) { return document.lookupNamespaceURI(prefix); } public boolean isEqualNode(org.w3c.dom.Node arg) { ! return document.isEqualNode(arg); } public Object getFeature(String feature, String version) { return document.getFeature(feature,version); --- 796,806 ---- public String lookupNamespaceURI(String prefix) { return document.lookupNamespaceURI(prefix); } public boolean isEqualNode(org.w3c.dom.Node arg) { ! return document.getDomDocument().isEqualNode(arg); } public Object getFeature(String feature, String version) { return document.getFeature(feature,version);
*** 783,793 **** UserDataHandler handler) { return document.setUserData(key, data, handler); } public Object getUserData(String key) { ! return document.getUserData(key); } public void recycleNode() { // Nothing seems to be required to be done here } --- 811,821 ---- UserDataHandler handler) { return document.setUserData(key, data, handler); } public Object getUserData(String key) { ! return document.getDomDocument().getUserData(key); } public void recycleNode() { // Nothing seems to be required to be done here }
< prev index next >