com.sun.xml.ws.security.opt.impl.outgoing
Class SecurityHeader

java.lang.Object
  extended by com.sun.xml.ws.security.opt.impl.outgoing.SecurityHeader

public class SecurityHeader
extends Object

Author:
K.Venugopal@sun.com

Field Summary
protected  int headerLayout
           
static int LAYOUT_LAX
           
static int LAYOUT_LAX_TS_FIRST
           
static int LAYOUT_LAX_TS_LAST
           
static int LAYOUT_STRICT
           
protected  ArrayList<SecurityHeaderElement> secHeaderContent
           
protected  String soapVersion
           
 
Constructor Summary
SecurityHeader()
          Default constructor uses Lax Message Layout and SOAP 1.1 version
SecurityHeader(int layout, String soapVersion, boolean muValue)
           
 
Method Summary
 void add(SecurityHeaderElement header)
           
 void append(SecurityHeaderElement element)
           
 String getAttribute(QName name)
          Gets the attribute value on the header element.
 String getAttribute(String nsUri, String localName)
          Gets the attribute value on the header element.
 SecurityHeaderElement getChildElement(String id)
           
 SecurityHeaderElement getChildElement(String localName, String uri)
           
 int getHeaderLayout()
           
 Iterator getHeaders(String localName, String uri)
           
 String getLocalPart()
          Gets the local name of this header element.
 String getNamespaceURI()
          Gets the namespace URI of this header element.
 String getSOAPVersion()
           
 void prepend(SecurityHeaderElement element)
           
 boolean replace(SecurityHeaderElement replaceThis, SecurityHeaderElement withThis)
           
 void setHeaderLayout(int headerLayout)
           
 void setSOAPVersion(String soapVersion)
           
 void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler)
          Writes out the header as SAX events.
 void writeTo(SOAPMessage saaj)
          Writes out the header to the given SOAPMessage.
 void writeTo(XMLStreamWriter streamWriter)
          Writes out the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

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:
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(SOAPMessage saaj)
             throws 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:
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


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.