org.systinet.wasp.addressing
Class AddressingHeaders

java.lang.Object
  extended byorg.systinet.wasp.addressing.AddressingHeaders
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class AddressingHeaders
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

WS-Addressing message addressing headers.

These (mostly optional) headers can augment a message with the following abstract properties:

to
Endpoint reference of the intended receiver of this message (recipient).
from
Endpoint reference of the endpoint where the message originated from (source endpoint).
replyTo
An endpoint reference that identifies the intended receiver for replies to this message (reply endpoint).
faultTo
An endpoint reference that identifies the intended receiver for faults related to this message (fault endpoint).
messageID
A URI that uniquely identifies this message in time and space.
relatesTo
Non-null array of AddressingHeaders.Relationship records containing messageID of a message to which this message relates to and the type of the relationship to the message. It usually contains zero or one record although the specification does not prohibit more than one record.

Since:
5.0
See Also:
Serialized Form
Component:
Core

Nested Class Summary
static class AddressingHeaders.Relationship
          A record containing messageID of a message to which this message relates to and the type of the relationship to the message.
 
Field Summary
 EndpointReference faultTo
          An endpoint reference that identifies the intended receiver for faults related to this message (fault endpoint).
 EndpointReference from
          Endpoint reference of the endpoint where the message originated from (source endpoint).
 java.lang.String messageID
          A URI that uniquely identifies this message in time and space.
 AddressingHeaders.Relationship[] relatesTo
           
 EndpointReference replyTo
          An endpoint reference that identifies the intended receiver for replies to this message (reply endpoint).
 EndpointReference to
          Endpoint reference of the intended receiver of this message (destination/recipient in case it contains more than sole address).
 
Constructor Summary
AddressingHeaders(EndpointReference to)
          Creates addressing headers with (mandatory according to specification) To field and no ID.
AddressingHeaders(EndpointReference to, AddressingHeaders request)
          Creates response addressing headers (with a unique ID of response based on addressing headers of the request.
AddressingHeaders(EndpointReference to, java.lang.String messageID)
          Creates addressing headers with (mandatory according to specification) To field and given MessageID.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
static java.lang.String generateUniqueMessageID()
          Generates unique message ID.
 java.lang.String getRelatedMessageID(QName relationshipType)
          Returns ID of message found between relatesTo records with given AddressingHeaders.Relationship.type.
 int hashCode()
           
 void setRelatedMessageID(java.lang.String messageID, QName relationshipType)
          Sets relatesTo to contain one record with given attributes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

to

public EndpointReference to
Endpoint reference of the intended receiver of this message (destination/recipient in case it contains more than sole address).


from

public EndpointReference from
Endpoint reference of the endpoint where the message originated from (source endpoint).


replyTo

public EndpointReference replyTo
An endpoint reference that identifies the intended receiver for replies to this message (reply endpoint). The sender should use the contents of the replyTo of the message being replied to to formulate the reply message. If the replyTo is absent, the sender MAY use the contents of the from to formulate the reply message.


faultTo

public EndpointReference faultTo
An endpoint reference that identifies the intended receiver for faults related to this message (fault endpoint). The sender shoult use the contents of the faultTo of the message being replied to to formulate the fault message. If the faultTo is absent, the sender may use the contents of the replyTo to formulate the fault message. If both the faultTo and replyTo are absent, the sender nay use the contents of the from to formulate the fault message. faultTo may be absent if the sender cannot receive fault messages (e.g., is a one-way application).


messageID

public java.lang.String messageID
A URI that uniquely identifies this message in time and space. No two messages may share a messageID property. The value of this property is an opaque URI whose interpretation beyond equivalence is not defined by the WS-Addressing specification.


relatesTo

public AddressingHeaders.Relationship[] relatesTo
Constructor Detail

AddressingHeaders

public AddressingHeaders(EndpointReference to)
Creates addressing headers with (mandatory according to specification) To field and no ID. You can later assign a unique ID generated by generateUniqueMessageID().


AddressingHeaders

public AddressingHeaders(EndpointReference to,
                         java.lang.String messageID)
Creates addressing headers with (mandatory according to specification) To field and given MessageID. You generate a unique ID calling generateUniqueMessageID().


AddressingHeaders

public AddressingHeaders(EndpointReference to,
                         AddressingHeaders request)
Creates response addressing headers (with a unique ID of response based on addressing headers of the request.

Parameters:
to - request.replyTo or request.faultTo (or even request.from)
request - the request
Method Detail

setRelatedMessageID

public void setRelatedMessageID(java.lang.String messageID,
                                QName relationshipType)
Sets relatesTo to contain one record with given attributes.

Parameters:
messageID - ID of the related message (see AddressingHeaders.Relationship.messageID)
relationshipType - type of relationship (see AddressingHeaders.Relationship.type)

getRelatedMessageID

public java.lang.String getRelatedMessageID(QName relationshipType)
Returns ID of message found between relatesTo records with given AddressingHeaders.Relationship.type. Use with relationshipType = AddressingHeaders.Relationship.RESPONSE to get the related request message ID.

Returns:
ID of related message or null if message with given relationshipType not found within relatesTo records

toString

public java.lang.String toString()

generateUniqueMessageID

public static java.lang.String generateUniqueMessageID()
Generates unique message ID. Useful with AddressingHeaders(EndpointReference, String).


equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

clone

public java.lang.Object clone()