Class DOMHeader<N extends Element>
- All Implemented Interfaces:
Header
- Direct Known Subclasses:
SAAJHeader
Header
implementation for a DOM.- Author:
- Kohsuke Kawaguchi
-
Field Summary
FieldsFields inherited from class com.sun.xml.ws.message.AbstractHeaderImpl
EMPTY_ATTS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getAttribute
(String nsUri, String localName) Gets the attribute value on the header element.Gets the local name of this header element.Gets the namespace URI of this header element.Used to obtain value XYZ from a header that looks like "<header>XYZ</header>".int
hashCode()
<T> T
readAsJAXB
(Bridge<T> bridge) Deprecated.<T> T
readAsJAXB
(javax.xml.bind.Unmarshaller unmarshaller) Reads the header as a JAXB object by using the given unmarshaller.Reads the header as aXMLStreamReader
.void
writeTo
(javax.xml.soap.SOAPMessage saaj) Writes out the header to the given SOAPMessage.void
Writes out the header as a fragment.void
writeTo
(ContentHandler contentHandler, ErrorHandler errorHandler) Writes out the header as SAX events.Methods inherited from class com.sun.xml.ws.message.AbstractHeaderImpl
getAttribute, getRole, isIgnorable, isRelay, parseBool, readAsEPR, readAsJAXB, readAsJAXB
-
Field Details
-
node
-
-
Constructor Details
-
DOMHeader
-
-
Method Details
-
getNamespaceURI
Description copied from interface:Header
Gets the namespace URI of this header element.- Returns:
- this string must be interned.
-
getLocalPart
Description copied from interface:Header
Gets the local name of this header element.- Returns:
- this string must be interned.
-
readHeader
Description copied from interface:Header
Reads the header as aXMLStreamReader
.The returned parser points at the start element of this header. (IOW,
XMLStreamReader.getEventType()
would returnXMLStreamConstants.START_ELEMENT
.Performance Expectation
For some
Header
implementations, this operation is a non-trivial operation. Therefore, use of this method is discouraged unless the caller is interested in reading the whole header.Similarly, if the caller wants to use this method only to do the API conversion (such as simply firing SAX events from
XMLStreamReader
), then the JAX-WS team requests that you talk to us.Message
s that come from tranport usually provides a reasonably efficient implementation of this method.- Returns:
- must not null.
- Throws:
XMLStreamException
-
readAsJAXB
public <T> T readAsJAXB(javax.xml.bind.Unmarshaller unmarshaller) throws javax.xml.bind.JAXBException Description copied from interface:Header
Reads the header as a JAXB object by using the given unmarshaller.- Specified by:
readAsJAXB
in interfaceHeader
- Overrides:
readAsJAXB
in classAbstractHeaderImpl
- Throws:
javax.xml.bind.JAXBException
-
readAsJAXB
Deprecated.Description copied from interface:Header
Reads the header as a JAXB object by using the given unmarshaller.- Specified by:
readAsJAXB
in interfaceHeader
- Overrides:
readAsJAXB
in classAbstractHeaderImpl
- Throws:
javax.xml.bind.JAXBException
-
writeTo
Description copied from interface:Header
Writes out the header as a fragment.- Throws:
XMLStreamException
- if the operation fails for some reason. This leaves the writer to an undefined state.
-
writeTo
Description copied from interface:Header
Writes out the header as SAX events.Sometimes a
Message
needs to produce SAX events, and this method is necessary for headers to participate to it.A header is responsible for producing the SAX events for its part, including
startPrefixMapping
andendPrefixMapping
, but not startDocument/endDocument.Note that SAX contract requires that any error that does NOT originate from
ContentHandler
(meaning any parsing error and etc) must be first reported toErrorHandler
. If the SAX event production cannot be continued and the processing needs to abort, the code may then throw the sameSAXParseException
reported toErrorHandler
.- Parameters:
contentHandler
- TheContentHandler
that receives SAX events.errorHandler
- TheErrorHandler
that receives parsing errors.- Throws:
SAXException
-
getAttribute
Description copied from interface:Header
Gets the attribute value on the header element.- Parameters:
nsUri
- The namespace URI of the attribute. Can be empty.localName
- The local name of the attribute.- Returns:
- if the attribute is found, return the whitespace normalized value.
(meaning no leading/trailing space, no consequtive whitespaces in-between.)
Otherwise null. Note that the XML parsers are responsible for
whitespace-normalizing attributes, so
Header
implementation doesn't have to do anything.
-
writeTo
public void writeTo(javax.xml.soap.SOAPMessage saaj) throws javax.xml.soap.SOAPException Description copied from interface:Header
Writes out the header to the given SOAPMessage.Sometimes a
Message
needs to produce itself asSOAPMessage
, in which case each header needs to turn itself into a header.- Throws:
javax.xml.soap.SOAPException
- if the operation fails for some reason. This leaves the writer to an undefined state.
-
getStringContent
Description copied from interface:Header
Used to obtain value XYZ from a header that looks like "<header>XYZ</header>". The primary use of this header for now is to access certain Addressing headers quickly.- Specified by:
getStringContent
in interfaceHeader
- Overrides:
getStringContent
in classAbstractHeaderImpl
- Returns:
- Can be empty but always non-null.
-
getWrappedNode
-
hashCode
public int hashCode() -
equals
-