- All Implemented Interfaces:
Header
- Direct Known Subclasses:
StreamHeader11
,StreamHeader12
Header
whose physical data representation is an XMLStreamBuffer.- Author:
- [email protected]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class
Keep the information about an attribute on the header element. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
protected String
protected final com.sun.xml.stream.buffer.XMLStreamBuffer
protected String
protected String
Role or actor value.Fields inherited from class com.sun.xml.ws.message.AbstractHeaderImpl
EMPTY_ATTS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StreamHeader
(XMLStreamReader reader) Creates aStreamHeader
.protected
StreamHeader
(XMLStreamReader reader, com.sun.xml.stream.buffer.XMLStreamBuffer mark) Creates aStreamHeader
. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(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.getRole
(SOAPVersion soapVersion) Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).final boolean
isIgnorable
(SOAPVersion soapVersion, Set<String> roles) Checks if this header is ignorable for us (IOW, make sure that this header has a problematic "mustUnderstand" header value that we have to reject.)boolean
isRelay()
True if this header is to be relayed if not processed.protected abstract com.sun.istack.FinalArrayList<StreamHeader.Attribute>
readAsEPR
(AddressingVersion expected) Creates an EPR without copying infoset.Reads the header as aXMLStreamReader
void
writeTo
(jakarta.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, getStringContent, parseBool, readAsJAXB, readAsJAXB
-
Field Details
-
_mark
protected final com.sun.xml.stream.buffer.XMLStreamBuffer _mark -
_isMustUnderstand
protected boolean _isMustUnderstand -
_role
Role or actor value. -
_isRelay
protected boolean _isRelay -
_localName
-
_namespaceURI
-
-
Constructor Details
-
StreamHeader
Creates aStreamHeader
.- Parameters:
reader
- The parser pointing at the start of the mark. Technically this information is redundant, but it achieves a better performance.mark
- The start of the buffered header content.
-
StreamHeader
Creates aStreamHeader
.- Parameters:
reader
- The parser that points to the start tag of the header. By the end of this method, the parser will point at the end tag of this element.- Throws:
XMLStreamException
-
-
Method Details
-
isIgnorable
Description copied from interface:Header
Checks if this header is ignorable for us (IOW, make sure that this header has a problematic "mustUnderstand" header value that we have to reject.)This method is used as a part of the mustUnderstanx processing. At the end of the processing, the JAX-WS identifies a list of
Header
s that were not understood. This method is invoked on thoseHeader
s, to verify that we don't need to report an error for it.specifically, this method has to perform the following tasks:
- If this header does not have
mustUnderstand
as "1" nor "true", then this method must return true. - Otherwise, check the role attribute (for SOAP 1.2) or the actor attribute (for SOAP 1.1).
When those attributes are absent, the default values have to be assumed.
See
Header.getRole(SOAPVersion)
for how the values are defaulted. Now, see if theroles
set contains the value. If so, this method must return false (indicating that an error is in order.) - Otherwise return true (since we don't play the role this header is intended for.)
- Specified by:
isIgnorable
in interfaceHeader
- Overrides:
isIgnorable
in classAbstractHeaderImpl
- Parameters:
soapVersion
- The caller specifies the SOAP version that the pipeline is working against. Often eachHeader
implementation already knows the SOAP version anyway, but this allows someHeader
s to avoid keeping it. That's why this redundant parameter is passed in.roles
- The set of role values that the current JAX-WS pipeline is assuming. Note that SOAP 1.1 and SOAP 1.2 use different strings for the same role, and the caller is responsible for supplying a proper value depending on the active SOAP version in use.- Returns:
- true if no error needs to be reported. False if an error needs to be raised. See the method javadoc for more discussion.
- If this header does not have
-
getRole
Description copied from interface:Header
Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).If the attribute is omitted, the value defaults to
SOAPVersion.implicitRole
.- Specified by:
getRole
in interfaceHeader
- Overrides:
getRole
in classAbstractHeaderImpl
- Parameters:
soapVersion
- The caller specifies the SOAP version that the pipeline is working against. Often eachHeader
implementation already knows the SOAP version anyway, but this allows someHeader
s to avoid keeping it. That's why this redundant parameter is passed in.- Returns:
- never null. This string need not be interned.
-
isRelay
public boolean isRelay()Description copied from interface:Header
True if this header is to be relayed if not processed. For SOAP 1.1 messages, this method always return false.IOW, this method returns true if there's @soap:relay='true' is present.
Implementation Note
The implementation needs to check for both "true" and "1", but because attribute values are normalized, it doesn't have to consider " true", " 1 ", and so on.
- Specified by:
isRelay
in interfaceHeader
- Overrides:
isRelay
in classAbstractHeaderImpl
- Returns:
- false.
-
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.
-
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.
-
readHeader
Reads the header as aXMLStreamReader
- Returns:
- must not null.
- Throws:
XMLStreamException
-
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
public void writeTo(jakarta.xml.soap.SOAPMessage saaj) throws jakarta.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:
jakarta.xml.soap.SOAPException
- 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
-
readAsEPR
Creates an EPR without copying infoset. This is the most common implementation on whichHeader.readAsEPR(AddressingVersion)
is invoked on.- Specified by:
readAsEPR
in interfaceHeader
- Overrides:
readAsEPR
in classAbstractHeaderImpl
- Parameters:
expected
- The version of the addressing used to parse the EPR. If the actual infoset and this doesn't agree, then you'll get anWebServiceException
stating that fact.- Returns:
- On a successful return, this method never returns null.
- Throws:
XMLStreamException
-
processHeaderAttributes
protected abstract com.sun.istack.FinalArrayList<StreamHeader.Attribute> processHeaderAttributes(XMLStreamReader reader)
-