public class HeaderList extends ArrayList<Header> implements MessageHeaders
Headers on a Message.
This list can be modified to add headers
from outside a Message, this is necessary
since intermediate processing layers often need to
put additional headers.
Following the SOAP convention, the order among headers
are not significant. However, Codecs are
expected to preserve the order of headers in the input
message as much as possible.
To perform SOAP mustUnderstang processing correctly, we need to keep
track of headers that are understood and headers that are not.
This is a collaborative process among Pipes, thus it's something
a Pipe author needs to keep in mind.
Specifically, when a Pipe sees a header and processes it
(that is, if it did enough computing with the header to claim that
the header is understood), then it should mark the corresponding
header as "understood". For example, when a pipe that handles JAX-WSA
examins the <wsa:To> header, it can claim that it understood the header.
But for example, if a pipe that does the signature verification checks
<wsa:To> for a signature, that would not be considered as "understood".
There are two ways to mark a header as understood:
Pipe knows it's going to understand a header
as long as it's present, so this is the easiest and thus the preferred way.
For example, if JAX-WSA looks for <wsa:To>, then it can set
markAsUnderstand to true, to do the obtaining of a header
and marking at the same time.
understood(int).
If under a rare circumstance, a pipe cannot determine whether
it can understand it or not when you are fetching a header, then
you can use this method afterward to mark it as understood.
Intuitively speaking, at the end of the day, if a header is not
understood but Header.isIgnorable(SOAPVersion, java.util.Set) is false, a bad thing
will happen. The actual implementation of the checking is more complicated,
for that see ClientMUTube/ServerMUTube.
Message.getHeaders(),
Serialized FormmodCount| Constructor and Description |
|---|
HeaderList()
Deprecated.
|
HeaderList(HeaderList that)
Copy constructor.
|
HeaderList(SOAPVersion soapVersion)
Creates an empty
HeaderList with the given soap version |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Header header)
Adds a new
Header. |
void |
addAll(Header... headers)
Adds all the headers.
|
protected void |
addInternal(int index,
Header header) |
boolean |
addOrReplace(Header header)
|
static HeaderList |
copy(HeaderList original)
Creates a copy.
|
void |
fillRequestAddressingHeaders(Packet packet,
AddressingVersion av,
SOAPVersion sv,
boolean oneway,
String action) |
void |
fillRequestAddressingHeaders(Packet packet,
AddressingVersion av,
SOAPVersion sv,
boolean oneway,
String action,
boolean mustUnderstand)
Creates a set of outbound WS-Addressing headers on the client with the
specified Action Message Addressing Property value.
|
void |
fillRequestAddressingHeaders(WSDLPort wsdlPort,
WSBinding binding,
Packet packet)
Creates a set of outbound WS-Addressing headers on the client with the
default Action Message Addressing Property value.
|
Header |
get(int index)
Gets the
Header at the specified index. |
Header |
get(QName name)
Deprecated.
Use
get(QName) |
Header |
get(QName name,
boolean markAsUnderstood)
Gets the first
Header of the specified name. |
Header |
get(String nsUri,
String localName)
Deprecated.
|
Header |
get(String nsUri,
String localName,
boolean markAsUnderstood)
Gets the first
Header of the specified name. |
String |
getAction(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
Action header. |
WSEndpointReference |
getFaultTo(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
FaultTo header. |
Iterator<Header> |
getHeaders() |
Iterator<Header> |
getHeaders(QName headerName,
boolean markAsUnderstood) |
Iterator<Header> |
getHeaders(String nsUri)
Deprecated.
|
Iterator<Header> |
getHeaders(String nsUri,
boolean markAsUnderstood)
Gets an iteration of headers
Header in the specified namespace,
including duplicates (if any.) |
Iterator<Header> |
getHeaders(String nsUri,
String localName)
Deprecated.
|
Iterator<Header> |
getHeaders(String nsUri,
String localName,
boolean markAsUnderstood)
Gets all the
Headers of the specified name,
including duplicates (if any.) |
String |
getMessageID(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
MessageID header. |
Set<QName> |
getNotUnderstoodHeaders(Set<String> roles,
Set<QName> knownHeaders,
WSBinding binding)
Returns a Set of QNames of headers that satisfy ALL the following conditions:
(a) Have mustUnderstand = true
(b) have NOT been explicitly marked as understood
(c) If roles argument is non-null, the header has isIgnorable = false
for the roles argument and SOAP version
(d) If non-null binding is passed in, are NOT understood by the binding
(e) If (d) is met, the header is NOT in the knownHeaders list passed in
|
String |
getRelatesTo(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
RelatesTo header. |
WSEndpointReference |
getReplyTo(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
ReplyTo header. |
String |
getTo(AddressingVersion av,
SOAPVersion sv)
Returns the value of WS-Addressing
To header. |
Set<QName> |
getUnderstoodHeaders()
Return a Set of QNames of headers that have been explicitly marked as understood.
|
boolean |
isUnderstood(Header header)
True if the header has been explicitly marked understood, false otherwise
|
boolean |
isUnderstood(int index)
Returns true if a
Header at the given index
was "understood". |
boolean |
isUnderstood(QName name)
True if the header has been explicitly marked understood, false otherwise
|
boolean |
isUnderstood(String nsUri,
String localName)
True if the header has been explicitly marked understood, false otherwise
|
void |
readResponseAddressingHeaders(WSDLPort wsdlPort,
WSBinding binding) |
Header |
remove(Header h) |
Header |
remove(int index)
Removes the first
Header of the specified name. |
boolean |
remove(Object o)
Removes a single instance of the specified element from this
header list, if it is present.
|
Header |
remove(QName name)
Removes the first
Header of the specified name. |
Header |
remove(String nsUri,
String localName)
Removes the first
Header of the specified name. |
protected Header |
removeInternal(int index) |
void |
setSoapVersion(SOAPVersion soapVersion) |
int |
size()
The total number of headers.
|
void |
understood(Header header)
|
void |
understood(int index)
Marks the
Header at the specified index as
"understood". |
void |
understood(QName name) |
void |
understood(String nsUri,
String localName) |
add, addAll, addAll, clear, clone, contains, ensureCapacity, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, removeRange, retainAll, set, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode@Deprecated public HeaderList()
HeaderList.public HeaderList(SOAPVersion soapVersion)
HeaderList with the given soap versionsoapVersion - public HeaderList(HeaderList that)
public int size()
public void addAll(Header... headers)
public Header get(int index)
public void understood(int index)
Header at the specified index as
"understood".public boolean isUnderstood(int index)
Header at the given index
was "understood".public void understood(@NotNull
Header header)
ArrayList, this operation requires
O(n) search of the array, and thus inherently inefficient.
Because of this, if you are developing a Pipe for
a performance sensitive environment, do not use this method.Header as "understood".understood in interface MessageHeadersIllegalArgumentException - if the given header is not contained
in this header.@Nullable public Header get(@NotNull String nsUri, @NotNull String localName, boolean markAsUnderstood)
Header of the specified name.get in interface MessageHeadersmarkAsUnderstood - If this parameter is true, the returned header will
be marked as "understood".public Header get(String nsUri, String localName)
get(String, String, boolean)@Nullable public Header get(@NotNull QName name, boolean markAsUnderstood)
Header of the specified name.get in interface MessageHeadersmarkAsUnderstood - If this parameter is true, the returned header will
be marked as "understood".@Nullable public Header get(@NotNull QName name)
get(QName)public Iterator<Header> getHeaders(String nsUri, String localName)
getHeaders(String, String, boolean)@NotNull public Iterator<Header> getHeaders(@NotNull String nsUri, @NotNull String localName, boolean markAsUnderstood)
Headers of the specified name,
including duplicates (if any.)getHeaders in interface MessageHeadersmarkAsUnderstood - If this parameter is true, the returned headers will
be marked as "understood" when they are returned
from Iterator.next().@NotNull public Iterator<Header> getHeaders(@NotNull QName headerName, boolean markAsUnderstood)
getHeaders in interface MessageHeadersgetHeaders(String, String, boolean)@NotNull public Iterator<Header> getHeaders(@NotNull String nsUri)
getHeaders(String, boolean).@NotNull public Iterator<Header> getHeaders(@NotNull String nsUri, boolean markAsUnderstood)
Header in the specified namespace,
including duplicates (if any.)getHeaders in interface MessageHeadersmarkAsUnderstood - If this parameter is true, the returned headers will
be marked as "understood" when they are returned
from Iterator.next().public String getTo(AddressingVersion av, SOAPVersion sv)
To header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate To headers are detected earlier.av - WS-Addressing versionsv - SOAP versionIllegalArgumentException - if either av or sv is null.public String getAction(@NotNull AddressingVersion av, @NotNull SOAPVersion sv)
Action header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate Action headers are detected earlier.av - WS-Addressing versionsv - SOAP versionIllegalArgumentException - if either av or sv is null.public WSEndpointReference getReplyTo(@NotNull AddressingVersion av, @NotNull SOAPVersion sv)
ReplyTo header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate ReplyTo headers are detected earlier.av - WS-Addressing versionsv - SOAP versionIllegalArgumentException - if either av or sv is null.public WSEndpointReference getFaultTo(@NotNull AddressingVersion av, @NotNull SOAPVersion sv)
FaultTo header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate FaultTo headers are detected earlier.av - WS-Addressing versionsv - SOAP versionIllegalArgumentException - if either av or sv is null.public String getMessageID(@NotNull AddressingVersion av, @NotNull SOAPVersion sv)
MessageID header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate MessageID headers are detected earlier.av - WS-Addressing versionsv - SOAP versionWebServiceException - if either av or sv is null.public String getRelatesTo(@NotNull AddressingVersion av, @NotNull SOAPVersion sv)
RelatesTo header. The version
identifies the WS-Addressing version and the header returned is targeted at
the current implicit role. Caches the value for subsequent invocation.
Duplicate RelatesTo headers are detected earlier.av - WS-Addressing versionsv - SOAP versionWebServiceException - if either av or sv is null.public void fillRequestAddressingHeaders(Packet packet, AddressingVersion av, SOAPVersion sv, boolean oneway, String action, boolean mustUnderstand)
This method needs to be invoked right after such a Message is
created which is error prone but so far only MEX, RM and JAX-WS
creates a request so this ugliness is acceptable. This method is also used
to create protocol messages that are not associated with any WSBinding
and WSDLPort.
packet - request packetav - WS-Addressing versionsv - SOAP versiononeway - Indicates if the message exchange pattern is onewayaction - Action Message Addressing Property valuemustUnderstand - to indicate if the addressing headers are set with mustUnderstand attributepublic void fillRequestAddressingHeaders(Packet packet, AddressingVersion av, SOAPVersion sv, boolean oneway, String action)
public void fillRequestAddressingHeaders(WSDLPort wsdlPort, @NotNull WSBinding binding, Packet packet)
This method needs to be invoked right after such a Message is created which is error prone but so far only MEX, RM and JAX-WS creates a request so this ugliness is acceptable. If more components are identified using this, then we may revisit this.
This method is used if default Action Message Addressing Property is to
be used. See
fillRequestAddressingHeaders(Packet, com.sun.xml.ws.api.addressing.AddressingVersion, com.sun.xml.ws.api.SOAPVersion, boolean, String)
if non-default Action is to be used, for example when creating a protocol message not
associated with WSBinding and WSDLPort.
This method uses SOAPAction as the Action unless set expplicitly in the wsdl.
wsdlPort - request WSDL portbinding - request WSBindingpacket - request packetpublic boolean add(Header header)
Header.
Order doesn't matter in headers, so this method does not make any guarantee as to where the new header is inserted.
@Nullable public Header remove(@NotNull String nsUri, @NotNull String localName)
Header of the specified name.remove in interface MessageHeadersnsUri - namespace URI of the header to removelocalName - local part of the FQN of the header to removepublic boolean addOrReplace(Header header)
Header or adds a new Header.
Order doesn't matter in headers, so this method does not make any guarantee as to where the new header is inserted.
addOrReplace in interface MessageHeadersprotected void addInternal(int index,
Header header)
protected Header removeInternal(int index)
@Nullable public Header remove(@NotNull QName name)
Header of the specified name.remove in interface MessageHeadersname - fully qualified name of the header to removepublic boolean remove(Object o)
remove in interface Collection<Header>remove in interface List<Header>remove in class ArrayList<Header>o - element to be removed from this list, if present.remove(javax.xml.namespace.QName)public static HeaderList copy(HeaderList original)
HeaderList correctly.original - Can be null, in which case null will be returned.public void readResponseAddressingHeaders(WSDLPort wsdlPort, WSBinding binding)
public void understood(QName name)
understood in interface MessageHeaderspublic void understood(String nsUri, String localName)
understood in interface MessageHeaderspublic Set<QName> getUnderstoodHeaders()
MessageHeadersgetUnderstoodHeaders in interface MessageHeaderspublic boolean isUnderstood(Header header)
MessageHeadersisUnderstood in interface MessageHeaderspublic boolean isUnderstood(String nsUri, String localName)
MessageHeadersisUnderstood in interface MessageHeaderspublic boolean isUnderstood(QName name)
MessageHeadersisUnderstood in interface MessageHeaderspublic Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding)
MessageHeadersgetNotUnderstoodHeaders in interface MessageHeaderspublic void setSoapVersion(SOAPVersion soapVersion)
public Iterator<Header> getHeaders()
getHeaders in interface MessageHeadersCopyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.