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, XMLMessage.UnknownContent, XMLMessage.XMLMultiPart

public abstract class AbstractMessageImpl extends Message
Partial Message implementation.

This class implements some of the Message methods. The idea is that those implementations may be non-optimal but it may save effort in implementing Message and reduce the code size.

Message classes that are used more commonly should examine carefully which method can be implemented faster, and override them accordingly.

Author:
Kohsuke Kawaguchi
  • Field Details

    • 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 Details

    • AbstractMessageImpl

      protected AbstractMessageImpl(SOAPVersion soapVersion)
    • AbstractMessageImpl

      protected AbstractMessageImpl(AbstractMessageImpl that)
      Copy constructor.
  • Method Details

    • getSOAPVersion

      public SOAPVersion getSOAPVersion()
      Overrides:
      getSOAPVersion in class Message
    • readEnvelopeAsSource

      public Source readEnvelopeAsSource()
      Description copied from class: Message
      Consumes this message including the envelope. returns it as a Source object.
      Specified by:
      readEnvelopeAsSource in class Message
    • readPayloadAsJAXB

      public <T> T readPayloadAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller) throws jakarta.xml.bind.JAXBException
      Description copied from class: Message
      Reads the payload as a JAXB object by using the given unmarshaller. This consumes the message.
      Specified by:
      readPayloadAsJAXB in class Message
      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: Message
      Reads the payload as a Data-Bond object This consumes the message.
      Specified by:
      readPayloadAsJAXB in class Message
      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 on Message.writePayloadTo(XMLStreamWriter)
      Specified by:
      writeTo in class Message
      Throws:
      XMLStreamException - If the XMLStreamWriter reports 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:
      writeTo in class Message
      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 as SAXParseException. SAXExceptions thrown from ErrorHandler should 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.SOAPException
      Default implementation that uses writeTo(ContentHandler, ErrorHandler)
      Specified by:
      readAsSOAPMessage in class Message
      Throws:
      jakarta.xml.soap.SOAPException - if there's any error while creating a SOAPMessage.
    • readAsSOAPMessage

      public jakarta.xml.soap.SOAPMessage readAsSOAPMessage(Packet packet, boolean inbound) throws jakarta.xml.soap.SOAPException
      Description copied from class: Message
      Creates the equivalent SOAPMessage from this message. It also uses transport specific headers from Packet during the SOAPMessage construction so that SOAPMessage.getMimeHeaders() gives meaningful transport headers. This consumes the message.
      Overrides:
      readAsSOAPMessage in class Message
      Throws:
      jakarta.xml.soap.SOAPException - if there's any error while creating a SOAPMessage.