jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java
changeset 19645 36f707905f2b
parent 16791 fe5141eabb0e
child 23782 953bfc3fbe31
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java	Wed Jul 05 19:07:31 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java	Fri Aug 23 09:57:21 2013 +0100
@@ -25,6 +25,7 @@
 
 package com.sun.xml.internal.ws.message;
 
+import com.sun.istack.internal.NotNull;
 import com.sun.xml.internal.bind.api.Bridge;
 import com.sun.xml.internal.ws.api.SOAPVersion;
 import com.sun.xml.internal.ws.api.message.Header;
@@ -33,8 +34,11 @@
 import com.sun.xml.internal.ws.api.message.MessageWritable;
 import com.sun.xml.internal.ws.api.message.Packet;
 import com.sun.xml.internal.ws.api.message.saaj.SAAJFactory;
+import com.sun.xml.internal.ws.encoding.TagInfoset;
 import com.sun.xml.internal.ws.message.saaj.SAAJMessage;
 import com.sun.xml.internal.ws.spi.db.XMLBridge;
+import java.util.ArrayList;
+import java.util.Collections;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
@@ -80,10 +84,34 @@
      */
     protected final SOAPVersion soapVersion;
 
+    protected @NotNull TagInfoset envelopeTag;
+    protected @NotNull TagInfoset headerTag;
+    protected @NotNull TagInfoset bodyTag;
+
+    protected static final AttributesImpl EMPTY_ATTS;
+    protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl();
+    protected static final List<TagInfoset> DEFAULT_TAGS;
+
+    static void create(SOAPVersion v, List c) {
+        int base = v.ordinal()*3;
+        c.add(base, new TagInfoset(v.nsUri, "Envelope", "S", EMPTY_ATTS,"S", v.nsUri));
+        c.add(base+1, new TagInfoset(v.nsUri, "Header", "S", EMPTY_ATTS));
+        c.add(base+2, new TagInfoset(v.nsUri, "Body", "S", EMPTY_ATTS));
+    }
+
+    static {
+        EMPTY_ATTS = new AttributesImpl();
+        List<TagInfoset> tagList = new ArrayList<TagInfoset>();
+        create(SOAPVersion.SOAP_11, tagList);
+        create(SOAPVersion.SOAP_12, tagList);
+        DEFAULT_TAGS = Collections.unmodifiableList(tagList);
+    }
+
     protected AbstractMessageImpl(SOAPVersion soapVersion) {
         this.soapVersion = soapVersion;
     }
 
+    @Override
     public SOAPVersion getSOAPVersion() {
         return soapVersion;
     }
@@ -94,10 +122,12 @@
         this.soapVersion = that.soapVersion;
     }
 
+    @Override
     public Source readEnvelopeAsSource() {
         return new SAXSource(new XMLReaderImpl(this), XMLReaderImpl.THE_SOURCE);
     }
 
+    @Override
     public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
         if(hasAttachments())
             unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments()));
@@ -108,11 +138,13 @@
         }
     }
     /** @deprecated */
+    @Override
     public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
         return bridge.unmarshal(readPayloadAsSource(),
             hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null );
     }
 
+    @Override
     public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
         return bridge.unmarshal(readPayloadAsSource(),
             hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null );
@@ -121,6 +153,7 @@
     /**
      * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
      */
+    @Override
     public void writeTo(XMLStreamWriter w) throws XMLStreamException {
         String soapNsUri = soapVersion.nsUri;
         w.writeStartDocument();
@@ -147,6 +180,7 @@
     /**
      * Writes the whole envelope as SAX events.
      */
+    @Override
     public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
         String soapNsUri = soapVersion.nsUri;
 
@@ -191,13 +225,12 @@
     /**
      * Default implementation that uses {@link #writeTo(ContentHandler, ErrorHandler)}
      */
+    @Override
     public SOAPMessage readAsSOAPMessage() throws SOAPException {
         return SAAJFactory.read(soapVersion, this);
     }
 
-    /**
-     *
-     */
+    @Override
     public SOAPMessage readAsSOAPMessage(Packet packet, boolean inbound) throws SOAPException {
         SOAPMessage msg = SAAJFactory.read(soapVersion, this, packet);
         transportHeaders(packet, inbound, msg);
@@ -211,7 +244,4 @@
         }
         if (msg.saveRequired()) msg.saveChanges();
     }
-
-    protected static final AttributesImpl EMPTY_ATTS = new AttributesImpl();
-    protected static final LocatorImpl NULL_LOCATOR = new LocatorImpl();
 }