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 Details

  • Constructor Details

    • SecurityHeader

      public SecurityHeader()
      Default constructor uses Lax Message Layout and SOAP 1.1 version
    • SecurityHeader

      public SecurityHeader(int layout, String soapVersion, boolean muValue)
  • Method Details

    • 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)
    • getHeaders

      public Iterator getHeaders(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:
    • 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(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

      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 to ErrorHandler. If the SAX event production cannot be continued and the processing needs to abort, the code may then throw the same SAXParseException reported to ErrorHandler.

      Parameters:
      contentHandler - The ContentHandler that receives SAX events.
      errorHandler - The ErrorHandler that receives parsing errors.
      Throws:
      SAXException