Package com.sun.xml.ws.message
Class AbstractMessageImpl
- java.lang.Object
-
- com.sun.xml.ws.api.message.Message
-
- com.sun.xml.ws.message.AbstractMessageImpl
-
- Direct Known Subclasses:
DOMMessage,EmptyMessageImpl,JAXBDispatchMessage,JAXBMessage,PayloadStreamReaderMessage,StreamMessage,VerifiedStreamMessage,XMLMessage.UnknownContent,XMLMessage.XMLMultiPart
public abstract class AbstractMessageImpl extends Message
PartialMessageimplementation.This class implements some of the
Messagemethods. The idea is that those implementations may be non-optimal but it may save effort in implementingMessageand reduce the code size.Messageclasses that are used more commonly should examine carefully which method can be implemented faster, and override them accordingly.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected TagInfosetbodyTagprotected static List<TagInfoset>DEFAULT_TAGSprotected static AttributesImplEMPTY_ATTSprotected TagInfosetenvelopeTagprotected TagInfosetheaderTagprotected static LocatorImplNULL_LOCATORprotected SOAPVersionsoapVersionSOAP version of this message.-
Fields inherited from class com.sun.xml.ws.api.message.Message
attachmentSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMessageImpl(SOAPVersion soapVersion)protectedAbstractMessageImpl(AbstractMessageImpl that)Copy constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SOAPVersiongetSOAPVersion()jakarta.xml.soap.SOAPMessagereadAsSOAPMessage()Default implementation that useswriteTo(ContentHandler, ErrorHandler)jakarta.xml.soap.SOAPMessagereadAsSOAPMessage(Packet packet, boolean inbound)Creates the equivalentSOAPMessagefrom this message.SourcereadEnvelopeAsSource()Consumes this message including the envelope.<T> TreadPayloadAsJAXB(XMLBridge<T> bridge)Reads the payload as a Data-Bond object This consumes the message.<T> TreadPayloadAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller)Reads the payload as a JAXB object by using the given unmarshaller.<T> TreadPayloadAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge)Deprecated.MessagetoSAAJ(Packet p, Boolean inbound)protected abstract voidwritePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment)Writes the payload to SAX events.voidwriteTo(XMLStreamWriter w)Default implementation that relies onMessage.writePayloadTo(XMLStreamWriter)voidwriteTo(ContentHandler contentHandler, ErrorHandler errorHandler)Writes the whole envelope as SAX events.voidwriteToBodyStart(XMLStreamWriter w)-
Methods inherited from class com.sun.xml.ws.api.message.Message
addSOAPMimeHeaders, assertOneWay, consume, copy, copyFrom, generateMessageID, getAttachments, getFirstDetailEntryName, getHeaders, getID, getID, getMethod, getOperation, getOperation, getPayloadLocalPart, getPayloadNamespaceURI, getTransportHeaders, getTransportHeaders, hasAttachments, hasHeaders, hasPayload, isFault, isOneWay, readPayload, readPayloadAsSource, setMessageMedadata, writePayloadTo
-
-
-
-
Field Detail
-
soapVersion
protected final SOAPVersion soapVersion
SOAP version of this message. Used to implement some of the methods, but nothing more than that.So if you aren't using those methods that use this field, this can be null.
-
envelopeTag
@NotNull protected TagInfoset envelopeTag
-
headerTag
@NotNull protected TagInfoset headerTag
-
bodyTag
@NotNull protected TagInfoset bodyTag
-
EMPTY_ATTS
protected static final AttributesImpl EMPTY_ATTS
-
NULL_LOCATOR
protected static final LocatorImpl NULL_LOCATOR
-
DEFAULT_TAGS
protected static final List<TagInfoset> DEFAULT_TAGS
-
-
Constructor Detail
-
AbstractMessageImpl
protected AbstractMessageImpl(SOAPVersion soapVersion)
-
AbstractMessageImpl
protected AbstractMessageImpl(AbstractMessageImpl that)
Copy constructor.
-
-
Method Detail
-
getSOAPVersion
public SOAPVersion getSOAPVersion()
- Overrides:
getSOAPVersionin classMessage
-
readEnvelopeAsSource
public Source readEnvelopeAsSource()
Description copied from class:MessageConsumes this message including the envelope. returns it as aSourceobject.- Specified by:
readEnvelopeAsSourcein classMessage
-
readPayloadAsJAXB
public <T> T readPayloadAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller) throws jakarta.xml.bind.JAXBExceptionDescription copied from class:MessageReads the payload as a JAXB object by using the given unmarshaller. This consumes the message.- Specified by:
readPayloadAsJAXBin classMessage- Throws:
jakarta.xml.bind.JAXBException- If JAXB reports an error during the processing.
-
readPayloadAsJAXB
public <T> T readPayloadAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge) throws jakarta.xml.bind.JAXBExceptionDeprecated.Description copied from class:MessageReads the payload as a JAXB object according to the givenBridge. This consumes the message.- Specified by:
readPayloadAsJAXBin classMessage- Returns:
- null if there's no payload.
- Throws:
jakarta.xml.bind.JAXBException- If JAXB reports an error during the processing.
-
readPayloadAsJAXB
public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws jakarta.xml.bind.JAXBException
Description copied from class:MessageReads the payload as a Data-Bond object This consumes the message.- Specified by:
readPayloadAsJAXBin classMessage- Returns:
- null if there's no payload.
- Throws:
jakarta.xml.bind.JAXBException- If JAXB reports an error during the processing.
-
writeToBodyStart
public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException
- Throws:
XMLStreamException
-
writeTo
public void writeTo(XMLStreamWriter w) throws XMLStreamException
Default implementation that relies onMessage.writePayloadTo(XMLStreamWriter)- Specified by:
writeToin classMessage- Throws:
XMLStreamException- If theXMLStreamWriterreports an error, or some other errors happen during the processing.
-
writeTo
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException
Writes the whole envelope as SAX events.- Specified by:
writeToin classMessage- Parameters:
contentHandler- must not be nulll.errorHandler- must not be null. any error encountered during the SAX event production must be first reported to this error handler. Fatal errors can be then thrown asSAXParseException.SAXExceptions thrown fromErrorHandlershould propagate directly through this method.- Throws:
SAXException
-
writePayloadTo
protected abstract void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException
Writes the payload to SAX events.- Parameters:
fragment- if true, this method will fire SAX events without start/endDocument events, suitable for embedding this into a bigger SAX event sequence. if false, this method generaets a completely SAX event sequence on its own.- Throws:
SAXException
-
toSAAJ
public Message toSAAJ(Packet p, Boolean inbound) throws jakarta.xml.soap.SOAPException
- Throws:
jakarta.xml.soap.SOAPException
-
readAsSOAPMessage
public jakarta.xml.soap.SOAPMessage readAsSOAPMessage() throws jakarta.xml.soap.SOAPExceptionDefault implementation that useswriteTo(ContentHandler, ErrorHandler)- Specified by:
readAsSOAPMessagein classMessage- Throws:
jakarta.xml.soap.SOAPException- if there's any error while creating aSOAPMessage.
-
readAsSOAPMessage
public jakarta.xml.soap.SOAPMessage readAsSOAPMessage(Packet packet, boolean inbound) throws jakarta.xml.soap.SOAPException
Description copied from class:MessageCreates the equivalentSOAPMessagefrom this message. It also uses transport specific headers from Packet during the SOAPMessage construction so thatSOAPMessage.getMimeHeaders()gives meaningful transport headers. This consumes the message.- Overrides:
readAsSOAPMessagein classMessage- Throws:
jakarta.xml.soap.SOAPException- if there's any error while creating aSOAPMessage.
-
-