--- old/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java 2013-08-13 18:18:01.479970885 +0200 +++ new/src/share/jaxws_classes/com/sun/xml/internal/ws/message/AbstractMessageImpl.java 2013-08-13 18:18:01.415968051 +0200 @@ -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 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 tagList = new ArrayList(); + 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 readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException { if(hasAttachments()) unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments())); @@ -108,11 +138,13 @@ } } /** @deprecated */ + @Override public T readPayloadAsJAXB(Bridge bridge) throws JAXBException { return bridge.unmarshal(readPayloadAsSource(), hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null ); } + @Override public T readPayloadAsJAXB(XMLBridge 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(); }