Class AbstractHeaderImpl
- java.lang.Object
-
- com.sun.xml.ws.message.AbstractHeaderImpl
-
- All Implemented Interfaces:
Header
- Direct Known Subclasses:
DOMHeader
,FaultDetailHeader
,GenericSecuredHeader
,JAXBHeader
,OutboundStreamHeader
,ProblemActionHeader
,StreamHeader
,StringHeader
public abstract class AbstractHeaderImpl extends Object implements Header
Partial default implementation ofHeader
.This is meant to be a convenient base class for
Header
-derived classes.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected static AttributesImpl
EMPTY_ATTS
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractHeaderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getAttribute(QName name)
Gets the attribute value on the header element.String
getRole(SOAPVersion soapVersion)
Gets the value of the soap:role attribute (or soap:actor for SOAP 1.1).String
getStringContent()
Used to obtain value XYZ from a header that looks like "<header>XYZ</header>".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 boolean
parseBool(String value)
Parses a string that looks likexs:boolean
into boolean.WSEndpointReference
readAsEPR(AddressingVersion expected)
Default implementation that copies the infoset.<T> T
readAsJAXB(XMLBridge<T> bridge)
Reads the header as a data-bond object<T> T
readAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller)
Reads the header as a JAXB object by using the given unmarshaller.<T> T
readAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge)
Deprecated.<T> T
readAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge, org.glassfish.jaxb.runtime.api.BridgeContext context)
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.xml.ws.api.message.Header
getAttribute, getLocalPart, getNamespaceURI, readHeader, writeTo, writeTo, writeTo
-
-
-
-
Field Detail
-
EMPTY_ATTS
protected static final AttributesImpl EMPTY_ATTS
-
-
Method Detail
-
readAsJAXB
public final <T> T readAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge, org.glassfish.jaxb.runtime.api.BridgeContext context) throws jakarta.xml.bind.JAXBException
Deprecated.- Throws:
jakarta.xml.bind.JAXBException
-
readAsJAXB
public <T> T readAsJAXB(jakarta.xml.bind.Unmarshaller unmarshaller) throws jakarta.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
- Throws:
jakarta.xml.bind.JAXBException
-
readAsJAXB
public <T> T readAsJAXB(org.glassfish.jaxb.runtime.api.Bridge<T> bridge) throws jakarta.xml.bind.JAXBException
Deprecated.Description copied from interface:Header
Reads the header as a JAXB object by using the given unmarshaller.- Specified by:
readAsJAXB
in interfaceHeader
- Throws:
jakarta.xml.bind.JAXBException
-
readAsJAXB
public <T> T readAsJAXB(XMLBridge<T> bridge) throws jakarta.xml.bind.JAXBException
Description copied from interface:Header
Reads the header as a data-bond object- Specified by:
readAsJAXB
in interfaceHeader
- Throws:
jakarta.xml.bind.JAXBException
-
readAsEPR
public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException
Default implementation that copies the infoset. Not terribly efficient.- Specified by:
readAsEPR
in interfaceHeader
- 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
-
isIgnorable
public boolean isIgnorable(@NotNull SOAPVersion soapVersion, @NotNull Set<String> roles)
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
- 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
@NotNull public String getRole(@NotNull SOAPVersion soapVersion)
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
- 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.
-
getAttribute
public String getAttribute(QName name)
Description copied from interface:Header
Gets the attribute value on the header element.This is a convenience method that calls into
Header.getAttribute(String, String)
- Specified by:
getAttribute
in interfaceHeader
- Parameters:
name
- Never null.- See Also:
Header.getAttribute(String, String)
-
parseBool
protected final boolean parseBool(String value)
Parses a string that looks likexs:boolean
into boolean. This method assumes that the whilespace normalization has already taken place.
-
getStringContent
public String 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
- Returns:
- Can be empty but always non-null.
-
-