Class SecurityHeader
- java.lang.Object
-
- com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader
-
public class SecurityHeader extends Object
- Author:
- K.Venugopal@sun.com
-
-
Field Summary
Fields Modifier and Type Field Description protected intheaderLayoutstatic intLAYOUT_LAXstatic intLAYOUT_LAX_TS_FIRSTstatic intLAYOUT_LAX_TS_LASTstatic intLAYOUT_STRICTprotected ArrayList<SecurityHeaderElement>secHeaderContentprotected StringsoapVersion
-
Constructor Summary
Constructors Constructor Description SecurityHeader()Default constructor uses Lax Message Layout and SOAP 1.1 versionSecurityHeader(int layout, String soapVersion, boolean muValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(SecurityHeaderElement header)voidappend(SecurityHeaderElement element)StringgetAttribute(String nsUri, String localName)Gets the attribute value on the header element.StringgetAttribute(QName name)Gets the attribute value on the header element.SecurityHeaderElementgetChildElement(String id)SecurityHeaderElementgetChildElement(String localName, String uri)intgetHeaderLayout()IteratorgetHeaders(String localName, String uri)StringgetLocalPart()Gets the local name of this header element.StringgetNamespaceURI()Gets the namespace URI of this header element.StringgetSOAPVersion()voidprepend(SecurityHeaderElement element)booleanreplace(SecurityHeaderElement replaceThis, SecurityHeaderElement withThis)voidsetHeaderLayout(int headerLayout)voidsetSOAPVersion(String soapVersion)voidwriteTo(jakarta.xml.soap.SOAPMessage saaj)Writes out the header to the given SOAPMessage.voidwriteTo(XMLStreamWriter streamWriter)Writes out the header.voidwriteTo(ContentHandler contentHandler, ErrorHandler errorHandler)Writes out the header as SAX events.
-
-
-
Field Detail
-
LAYOUT_LAX
public static final int LAYOUT_LAX
- See Also:
- Constant Field Values
-
LAYOUT_STRICT
public static final int LAYOUT_STRICT
- See Also:
- Constant Field Values
-
LAYOUT_LAX_TS_FIRST
public static final int LAYOUT_LAX_TS_FIRST
- See Also:
- Constant Field Values
-
LAYOUT_LAX_TS_LAST
public static final int LAYOUT_LAX_TS_LAST
- See Also:
- Constant Field Values
-
secHeaderContent
protected ArrayList<SecurityHeaderElement> secHeaderContent
-
headerLayout
protected int headerLayout
-
soapVersion
protected String soapVersion
-
-
Constructor Detail
-
SecurityHeader
public SecurityHeader()
Default constructor uses Lax Message Layout and SOAP 1.1 version
-
SecurityHeader
public SecurityHeader(int layout, String soapVersion, boolean muValue)
-
-
Method Detail
-
getHeaderLayout
public int getHeaderLayout()
-
setHeaderLayout
public void setHeaderLayout(int headerLayout)
-
getSOAPVersion
public String getSOAPVersion()
-
setSOAPVersion
public void setSOAPVersion(String soapVersion)
-
getChildElement
public SecurityHeaderElement getChildElement(String localName, String uri)
-
getChildElement
public SecurityHeaderElement getChildElement(String id)
-
add
public void add(SecurityHeaderElement header)
-
replace
public boolean replace(SecurityHeaderElement replaceThis, SecurityHeaderElement withThis)
-
prepend
public void prepend(SecurityHeaderElement element)
-
append
public void append(SecurityHeaderElement element)
-
getNamespaceURI
@NotNull public String getNamespaceURI()
Gets the namespace URI of this header element.- Returns:
- this string must be interned.
-
getLocalPart
@NotNull public String getLocalPart()
Gets the local name of this header element.- Returns:
- this string must be interned.
-
getAttribute
@Nullable public String getAttribute(@NotNull String nsUri, @NotNull String localName)
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.
-
getAttribute
@Nullable public String getAttribute(@NotNull QName name)
Gets the attribute value on the header element.This is a convenience method that calls into
getAttribute(String, String)- Parameters:
name- Never null.- See Also:
getAttribute(String, String)
-
writeTo
public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException
Writes out the header.- 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.SOAPExceptionWrites out the header to the given SOAPMessage.Sometimes a Message needs to produce itself as
SOAPMessage, 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
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException
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 and endPrefixMapping, 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 same SAXParseException reported toErrorHandler.- Parameters:
contentHandler- TheContentHandlerthat receives SAX events.errorHandler- TheErrorHandlerthat receives parsing errors.- Throws:
SAXException
-
-