Class SecurityHeader
- Author:
- K.Venugopal@sun.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intstatic final intstatic final intstatic final intstatic final intprotected ArrayList<SecurityHeaderElement>protected String -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor uses Lax Message Layout and SOAP 1.1 versionSecurityHeader(int layout, String soapVersion, boolean muValue) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SecurityHeaderElement header) voidappend(SecurityHeaderElement element) getAttribute(String nsUri, String localName) Gets the attribute value on the header element.getAttribute(QName name) Gets the attribute value on the header element.getChildElement(String localName, String uri) intgetHeaders(String localName, String uri) Gets the local name of this header element.Gets the namespace URI of this header element.voidprepend(SecurityHeaderElement element) booleanreplace(SecurityHeaderElement replaceThis, SecurityHeaderElement withThis) voidsetHeaderLayout(int headerLayout) voidsetSOAPVersion(String soapVersion) voidwriteTo(javax.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 Details
-
LAYOUT_LAX
public static final int LAYOUT_LAX- See Also:
-
LAYOUT_STRICT
public static final int LAYOUT_STRICT- See Also:
-
LAYOUT_LAX_TS_FIRST
public static final int LAYOUT_LAX_TS_FIRST- See Also:
-
LAYOUT_LAX_TS_LAST
public static final int LAYOUT_LAX_TS_LAST- See Also:
-
secHeaderContent
-
headerLayout
protected int headerLayout -
soapVersion
-
-
Constructor Details
-
SecurityHeader
public SecurityHeader()Default constructor uses Lax Message Layout and SOAP 1.1 version -
SecurityHeader
-
-
Method Details
-
getHeaderLayout
public int getHeaderLayout() -
setHeaderLayout
public void setHeaderLayout(int headerLayout) -
getSOAPVersion
-
setSOAPVersion
-
getChildElement
-
getHeaders
-
getChildElement
-
add
-
replace
-
prepend
-
append
-
getNamespaceURI
Gets the namespace URI of this header element.- Returns:
- this string must be interned.
-
getLocalPart
Gets the local name of this header element.- Returns:
- this string must be interned.
-
getAttribute
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
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:
-
writeTo
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(javax.xml.soap.SOAPMessage saaj) throws javax.xml.soap.SOAPException Writes 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:
javax.xml.soap.SOAPException- if the operation fails for some reason. This leaves the writer to an undefined state.
-
writeTo
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
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 same SAXParseException reported toErrorHandler.- Parameters:
contentHandler- TheContentHandlerthat receives SAX events.errorHandler- TheErrorHandlerthat receives parsing errors.- Throws:
SAXException
-