Class DOMHeader<N extends Element>
- java.lang.Object
-
- com.sun.xml.ws.message.AbstractHeaderImpl
-
- com.sun.xml.ws.message.DOMHeader<N>
-
- All Implemented Interfaces:
Header
- Direct Known Subclasses:
SAAJHeader
public class DOMHeader<N extends Element> extends AbstractHeaderImpl
Headerimplementation for a DOM.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected Nnode-
Fields inherited from class com.sun.xml.ws.message.AbstractHeaderImpl
EMPTY_ATTS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object obj)StringgetAttribute(String nsUri, String localName)Gets the attribute value on the header element.StringgetLocalPart()Gets the local name of this header element.StringgetNamespaceURI()Gets the namespace URI of this header element.StringgetStringContent()Used to obtain value XYZ from a header that looks like "<header>XYZ</header>".NgetWrappedNode()inthashCode()<T> TreadAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller)Reads the header as a JAXB object by using the given unmarshaller.<T> TreadAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge)Deprecated.XMLStreamReaderreadHeader()Reads the header as aXMLStreamReader.voidwriteTo(jakarta.xml.soap.SOAPMessage saaj)Writes out the header to the given SOAPMessage.voidwriteTo(XMLStreamWriter w)Writes out the header as a fragment.voidwriteTo(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
-
-
-
-
Constructor Detail
-
DOMHeader
public DOMHeader(N node)
-
-
Method Detail
-
getNamespaceURI
public String getNamespaceURI()
Description copied from interface:HeaderGets the namespace URI of this header element.- Returns:
- this string must be interned.
-
getLocalPart
public String getLocalPart()
Description copied from interface:HeaderGets the local name of this header element.- Returns:
- this string must be interned.
-
readHeader
public XMLStreamReader readHeader() throws XMLStreamException
Description copied from interface:HeaderReads 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
Headerimplementations, 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.Messages that come from tranport usually provides a reasonably efficient implementation of this method.- Returns:
- must not null.
- Throws:
XMLStreamException
-
readAsJAXB
public <T> T readAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller) throws jakarta.xml.bind.JAXBExceptionDescription copied from interface:HeaderReads the header as a JAXB object by using the given unmarshaller.- Specified by:
readAsJAXBin interfaceHeader- Overrides:
readAsJAXBin classAbstractHeaderImpl- Throws:
jakarta.xml.bind.JAXBException
-
readAsJAXB
public <T> T readAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge) throws jakarta.xml.bind.JAXBExceptionDeprecated.Description copied from interface:HeaderReads the header as a JAXB object by using the given unmarshaller.- Specified by:
readAsJAXBin interfaceHeader- Overrides:
readAsJAXBin classAbstractHeaderImpl- Throws:
jakarta.xml.bind.JAXBException
-
writeTo
public void writeTo(XMLStreamWriter w) throws XMLStreamException
Description copied from interface:HeaderWrites out the header as a fragment.- Throws:
XMLStreamException- if the operation fails for some reason. This leaves the writer to an undefined state.
-
writeTo
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException
Description copied from interface:HeaderWrites out the header as SAX events.Sometimes a
Messageneeds 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
startPrefixMappingandendPrefixMapping, 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 sameSAXParseExceptionreported toErrorHandler.- Parameters:
contentHandler- TheContentHandlerthat receives SAX events.errorHandler- TheErrorHandlerthat receives parsing errors.- Throws:
SAXException
-
getAttribute
public String getAttribute(String nsUri, String localName)
Description copied from interface:HeaderGets 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
Headerimplementation doesn't have to do anything.
-
writeTo
public void writeTo(jakarta.xml.soap.SOAPMessage saaj) throws jakarta.xml.soap.SOAPExceptionDescription copied from interface:HeaderWrites out the header to the given SOAPMessage.Sometimes a
Messageneeds to produce itself asSOAPMessage, in which case each header needs to turn itself into a header.- Throws:
jakarta.xml.soap.SOAPException- if the operation fails for some reason. This leaves the writer to an undefined state.
-
getStringContent
public String getStringContent()
Description copied from interface:HeaderUsed 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:
getStringContentin interfaceHeader- Overrides:
getStringContentin classAbstractHeaderImpl- Returns:
- Can be empty but always non-null.
-
getWrappedNode
public N getWrappedNode()
-
-