|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
13
|
|
|
|
14
|
|
|
|
15
|
|
|
|
16
|
|
|
|
17
|
|
|
|
18
|
|
package org.codehaus.activesoap.policy.addressing;
|
|
19
|
|
|
|
20
|
|
import org.codehaus.activesoap.MessageExchange;
|
|
21
|
|
import org.codehaus.activesoap.handler.stax.ElementContent;
|
|
22
|
|
import org.codehaus.activesoap.handler.stax.StaxHelper;
|
|
23
|
|
import org.codehaus.activesoap.handler.stax.AnyElementMarshaler;
|
|
24
|
|
|
|
25
|
|
import javax.xml.namespace.QName;
|
|
26
|
|
import javax.xml.stream.XMLStreamWriter;
|
|
27
|
|
import javax.xml.stream.XMLStreamException;
|
|
28
|
|
import java.util.HashMap;
|
|
29
|
|
import java.util.Map;
|
|
30
|
|
|
|
31
|
|
|
|
32
|
|
|
|
33
|
|
|
|
34
|
|
|
|
35
|
|
|
|
36
|
|
public class AddressingContext implements ElementContent {
|
|
37
|
|
public final static QName FaultTo_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "FaultTo", "wsa");
|
|
38
|
|
public final static QName Action_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "Action", "wsa");
|
|
39
|
|
public final static QName From_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "From", "wsa");
|
|
40
|
|
public final static QName Recipient_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "Recipient", "wsa");
|
|
41
|
|
public final static QName To_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "To", "wsa");
|
|
42
|
|
public final static QName ReplyTo_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "ReplyTo", "wsa");
|
|
43
|
|
public final static QName MessageID_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "MessageID", "wsa");
|
|
44
|
|
public final static QName RelatesTo_QNAME = new QName("http://schemas.xmlsoap.org/ws/2003/03/addressing", "RelatesTo", "wsa");
|
|
45
|
|
|
|
46
|
|
private static final String CONTEXT_KEY = AddressingContext.class.getName();
|
|
47
|
|
|
|
48
|
|
private AttributedURI messageID;
|
|
49
|
|
private Relationship relatesTo;
|
|
50
|
|
private AttributedURI to;
|
|
51
|
|
private AttributedURI action;
|
|
52
|
|
private EndpointReferenceType from;
|
|
53
|
|
private EndpointReferenceType replyTo;
|
|
54
|
|
private EndpointReferenceType faultTo;
|
|
55
|
|
private EndpointReferenceType recipient;
|
|
56
|
|
private Map properties = new HashMap();
|
|
57
|
|
|
|
58
|
|
|
|
59
|
|
|
|
60
|
|
|
|
61
|
|
|
|
62
|
|
|
|
63
|
13
|
public static AddressingContext getContext(MessageExchange exchange) {
|
|
64
|
13
|
AddressingContext context = (AddressingContext) exchange.getProperty(CONTEXT_KEY);
|
|
65
|
13
|
if (context == null) {
|
|
66
|
4
|
context = new AddressingContext();
|
|
67
|
4
|
exchange.setProperty(CONTEXT_KEY, context);
|
|
68
|
|
}
|
|
69
|
13
|
return context;
|
|
70
|
|
}
|
|
71
|
|
|
|
72
|
0
|
public static void setContext(MessageExchange exchange, AddressingContext context) {
|
|
73
|
0
|
exchange.setProperty(CONTEXT_KEY, context);
|
|
74
|
|
}
|
|
75
|
|
|
|
76
|
8
|
public AttributedURI getMessageID() {
|
|
77
|
8
|
return messageID;
|
|
78
|
|
}
|
|
79
|
|
|
|
80
|
3
|
public void setMessageID(AttributedURI messageID) {
|
|
81
|
3
|
this.messageID = messageID;
|
|
82
|
|
}
|
|
83
|
|
|
|
84
|
0
|
public Relationship getRelatesTo() {
|
|
85
|
0
|
return relatesTo;
|
|
86
|
|
}
|
|
87
|
|
|
|
88
|
0
|
public void setRelatesTo(Relationship relatesTo) {
|
|
89
|
0
|
this.relatesTo = relatesTo;
|
|
90
|
|
}
|
|
91
|
|
|
|
92
|
9
|
public AttributedURI getTo() {
|
|
93
|
9
|
return to;
|
|
94
|
|
}
|
|
95
|
|
|
|
96
|
3
|
public void setTo(AttributedURI to) {
|
|
97
|
3
|
this.to = to;
|
|
98
|
|
}
|
|
99
|
|
|
|
100
|
8
|
public AttributedURI getAction() {
|
|
101
|
8
|
return action;
|
|
102
|
|
}
|
|
103
|
|
|
|
104
|
3
|
public void setAction(AttributedURI action) {
|
|
105
|
3
|
this.action = action;
|
|
106
|
|
}
|
|
107
|
|
|
|
108
|
0
|
public EndpointReferenceType getFrom() {
|
|
109
|
0
|
return from;
|
|
110
|
|
}
|
|
111
|
|
|
|
112
|
0
|
public void setFrom(EndpointReferenceType from) {
|
|
113
|
0
|
this.from = from;
|
|
114
|
|
}
|
|
115
|
|
|
|
116
|
8
|
public EndpointReferenceType getReplyTo() {
|
|
117
|
8
|
return replyTo;
|
|
118
|
|
}
|
|
119
|
|
|
|
120
|
3
|
public void setReplyTo(EndpointReferenceType replyTo) {
|
|
121
|
3
|
this.replyTo = replyTo;
|
|
122
|
|
}
|
|
123
|
|
|
|
124
|
0
|
public EndpointReferenceType getFaultTo() {
|
|
125
|
0
|
return faultTo;
|
|
126
|
|
}
|
|
127
|
|
|
|
128
|
0
|
public void setFaultTo(EndpointReferenceType faultTo) {
|
|
129
|
0
|
this.faultTo = faultTo;
|
|
130
|
|
}
|
|
131
|
|
|
|
132
|
0
|
public EndpointReferenceType getRecipient() {
|
|
133
|
0
|
return recipient;
|
|
134
|
|
}
|
|
135
|
|
|
|
136
|
0
|
public void setRecipient(EndpointReferenceType recipient) {
|
|
137
|
0
|
this.recipient = recipient;
|
|
138
|
|
}
|
|
139
|
|
|
|
140
|
0
|
public void addProperty(QName name, Object value) {
|
|
141
|
0
|
properties.put(name, value);
|
|
142
|
|
}
|
|
143
|
|
|
|
144
|
0
|
public Map getProperties() {
|
|
145
|
0
|
return properties;
|
|
146
|
|
}
|
|
147
|
|
|
|
148
|
0
|
public void setProperties(Map properties) {
|
|
149
|
0
|
this.properties = properties;
|
|
150
|
|
}
|
|
151
|
|
|
|
152
|
1
|
public void writeContent(AnyElementMarshaler marshaler, XMLStreamWriter out) throws XMLStreamException {
|
|
153
|
1
|
StaxHelper.writeElement(MessageID_QNAME, messageID, marshaler, out);
|
|
154
|
1
|
StaxHelper.writeElement(RelatesTo_QNAME, relatesTo, marshaler, out);
|
|
155
|
1
|
StaxHelper.writeElement(To_QNAME, to, marshaler, out);
|
|
156
|
1
|
StaxHelper.writeElement(Action_QNAME, action, marshaler, out);
|
|
157
|
1
|
StaxHelper.writeElement(From_QNAME, from, marshaler, out);
|
|
158
|
1
|
StaxHelper.writeElement(ReplyTo_QNAME, replyTo, marshaler, out);
|
|
159
|
1
|
StaxHelper.writeElement(FaultTo_QNAME, faultTo, marshaler, out);
|
|
160
|
1
|
StaxHelper.writeElement(Recipient_QNAME, recipient, marshaler, out);
|
|
161
|
|
}
|
|
162
|
|
}
|
|
163
|
|
|