1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
35 import com.sun.xml.internal.ws.api.pipe.TubeCloner; |
35 import com.sun.xml.internal.ws.api.pipe.TubeCloner; |
36 import com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException; |
36 import com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException; |
37 import com.sun.xml.internal.ws.addressing.model.InvalidAddressingHeaderException; |
37 import com.sun.xml.internal.ws.addressing.model.InvalidAddressingHeaderException; |
38 import static com.sun.xml.internal.ws.addressing.W3CAddressingConstants.ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED; |
38 import static com.sun.xml.internal.ws.addressing.W3CAddressingConstants.ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED; |
39 import static com.sun.xml.internal.ws.addressing.W3CAddressingConstants.ONLY_ANONYMOUS_ADDRESS_SUPPORTED; |
39 import static com.sun.xml.internal.ws.addressing.W3CAddressingConstants.ONLY_ANONYMOUS_ADDRESS_SUPPORTED; |
40 import com.sun.xml.internal.ws.resources.AddressingMessages; |
|
41 import com.sun.istack.internal.NotNull; |
40 import com.sun.istack.internal.NotNull; |
42 import com.sun.istack.internal.Nullable; |
41 import com.sun.istack.internal.Nullable; |
43 |
42 |
44 import javax.xml.ws.soap.AddressingFeature; |
43 import javax.xml.ws.soap.AddressingFeature; |
45 import javax.xml.ws.WebServiceException; |
|
46 |
44 |
47 /** |
45 /** |
48 * @author Rama Pulavarthi |
46 * @author Rama Pulavarthi |
49 */ |
47 */ |
50 public class W3CWsaServerTube extends WsaServerTube{ |
48 public class W3CWsaServerTube extends WsaServerTube{ |
133 default: |
131 default: |
134 // ALL: no check |
132 // ALL: no check |
135 } |
133 } |
136 } |
134 } |
137 |
135 |
138 /* |
|
139 @Override |
|
140 protected boolean isAnonymousRequired(@Nullable WSDLBoundOperation wbo) { |
|
141 return getResponseRequirement(wbo) == AddressingFeature.Responses.ANONYMOUS; |
|
142 } |
|
143 |
|
144 private AddressingFeature.Responses getResponseRequirement(@Nullable WSDLBoundOperation wbo) { |
|
145 if (af.getResponses() == AddressingFeature.Responses.ALL && wbo != null) { |
|
146 //wsaw wsdl binding case will have some value set on wbo |
|
147 WSDLBoundOperation.ANONYMOUS anon = wbo.getAnonymous(); |
|
148 if (wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.required) |
|
149 return AddressingFeature.Responses.ANONYMOUS; |
|
150 else if (wbo.getAnonymous() == WSDLBoundOperation.ANONYMOUS.prohibited) |
|
151 return AddressingFeature.Responses.NON_ANONYMOUS; |
|
152 else |
|
153 return AddressingFeature.Responses.ALL; |
|
154 |
|
155 } else |
|
156 return af.getResponses(); |
|
157 } |
|
158 |
|
159 @Override |
|
160 protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) { |
|
161 String replyToValue = null; |
|
162 String faultToValue = null; |
|
163 |
|
164 if (replyTo != null) |
|
165 replyToValue = replyTo.getAddress(); |
|
166 |
|
167 if (faultTo != null) |
|
168 faultToValue = faultTo.getAddress(); |
|
169 AddressingFeature.Responses responseRequirement = getResponseRequirement(wbo); |
|
170 |
|
171 switch (responseRequirement) { |
|
172 case NON_ANONYMOUS: |
|
173 if (replyToValue != null && replyToValue.equals(addressingVersion.anonymousUri)) |
|
174 throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED); |
|
175 |
|
176 if (faultToValue != null && faultToValue.equals(addressingVersion.anonymousUri)) |
|
177 throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_NON_ANONYMOUS_ADDRESS_SUPPORTED); |
|
178 break; |
|
179 case ANONYMOUS: |
|
180 if (replyToValue != null && !replyToValue.equals(addressingVersion.anonymousUri)) |
|
181 throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED); |
|
182 |
|
183 if (faultToValue != null && !faultToValue.equals(addressingVersion.anonymousUri)) |
|
184 throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, ONLY_ANONYMOUS_ADDRESS_SUPPORTED); |
|
185 break; |
|
186 default: |
|
187 // ALL: no check |
|
188 } |
|
189 } |
|
190 */ |
|
191 } |
136 } |