Tue, 09 Apr 2013 14:51:13 +0100
8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com
ohair@286 | 1 | /* |
alanb@368 | 2 | * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package javax.xml.ws.soap; |
ohair@286 | 27 | |
ohair@286 | 28 | import javax.xml.ws.WebServiceFeature; |
ohair@286 | 29 | import javax.xml.ws.Endpoint; |
ohair@286 | 30 | import javax.xml.ws.Service; |
ohair@286 | 31 | |
ohair@286 | 32 | /** |
ohair@286 | 33 | * AddressingFeature represents the use of WS-Addressing with either |
ohair@286 | 34 | * the SOAP 1.1/HTTP or SOAP 1.2/HTTP binding. Using this feature |
ohair@286 | 35 | * with any other binding is undefined. |
ohair@286 | 36 | * <p> |
ohair@286 | 37 | * This feature can be used during the creation of SEI proxy, and |
alanb@368 | 38 | * {@link javax.xml.ws.Dispatch} instances on the client side and {@link Endpoint} |
ohair@286 | 39 | * instances on the server side. This feature cannot be used for {@link Service} |
ohair@286 | 40 | * instance creation on the client side. |
ohair@286 | 41 | * <p> |
ohair@286 | 42 | * The following describes the effects of this feature with respect |
ohair@286 | 43 | * to be enabled or disabled: |
ohair@286 | 44 | * <ul> |
ohair@286 | 45 | * <li> ENABLED: In this Mode, WS-Addressing will be enabled. It means |
ohair@286 | 46 | * the endpoint supports WS-Addressing but does not require its use. |
ohair@286 | 47 | * A sender could send messages with WS-Addressing headers or without |
ohair@286 | 48 | * WS-Addressing headers. But a receiver MUST consume both types of |
ohair@286 | 49 | * messages. |
ohair@286 | 50 | * <li> DISABLED: In this Mode, WS-Addressing will be disabled. |
ohair@286 | 51 | * At runtime, WS-Addressing headers MUST NOT be used by a sender or |
ohair@286 | 52 | * receiver. |
ohair@286 | 53 | * </ul> |
ohair@286 | 54 | * <p> |
ohair@286 | 55 | * If the feature is enabled, the <code>required</code> property determines |
ohair@286 | 56 | * whether the endpoint requires WS-Addressing. If it is set true, |
ohair@286 | 57 | * WS-Addressing headers MUST be present on incoming and outgoing messages. |
ohair@286 | 58 | * By default the <code>required</code> property is <code>false</code>. |
ohair@286 | 59 | * |
ohair@286 | 60 | * <p> |
ohair@286 | 61 | * If the web service developer has not explicitly enabled this feature, |
ohair@286 | 62 | * WSDL's wsam:Addressing policy assertion is used to find |
ohair@286 | 63 | * the use of WS-Addressing. By using the feature explicitly, an application |
ohair@286 | 64 | * overrides WSDL's indication of the use of WS-Addressing. In some cases, |
ohair@286 | 65 | * this is really required. For example, if an application has implemented |
ohair@286 | 66 | * WS-Addressing itself, it can use this feature to disable addressing. That |
ohair@286 | 67 | * means a JAX-WS implementation doesn't consume or produce WS-Addressing |
ohair@286 | 68 | * headers. |
ohair@286 | 69 | * |
ohair@286 | 70 | * <p> |
ohair@286 | 71 | * If addressing is enabled, a corresponding wsam:Addressing policy assertion |
ohair@286 | 72 | * must be generated in the WSDL as per |
ohair@286 | 73 | * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicyassertions"> |
ohair@286 | 74 | * 3.1 WS-Policy Assertions</a> |
ohair@286 | 75 | * |
ohair@286 | 76 | * <p> |
ohair@286 | 77 | * <b>Example 1: </b>Possible Policy Assertion in the generated WSDL for |
ohair@286 | 78 | * <code>@Addressing</code> |
ohair@286 | 79 | * <pre> |
ohair@286 | 80 | * <wsam:Addressing wsp:Optional="true"> |
ohair@286 | 81 | * <wsp:Policy/> |
ohair@286 | 82 | * </wsam:Addressing> |
ohair@286 | 83 | * </pre> |
ohair@286 | 84 | * |
ohair@286 | 85 | * <p> |
ohair@286 | 86 | * <b>Example 2: </b>Possible Policy Assertion in the generated WSDL for |
ohair@286 | 87 | * <code>@Addressing(required=true)</code> |
ohair@286 | 88 | * <pre> |
ohair@286 | 89 | * <wsam:Addressing> |
ohair@286 | 90 | * <wsp:Policy/> |
ohair@286 | 91 | * </wsam:Addressing> |
ohair@286 | 92 | * </pre> |
ohair@286 | 93 | * |
ohair@286 | 94 | * <p> |
ohair@286 | 95 | * <b>Example 3: </b>Possible Policy Assertion in the generated WSDL for |
ohair@286 | 96 | * <code>@Addressing(required=true, responses=Responses.ANONYMOUS)</code> |
ohair@286 | 97 | * <pre> |
ohair@286 | 98 | * <wsam:Addressing> |
ohair@286 | 99 | * <wsp:Policy> |
ohair@286 | 100 | * <wsam:AnonymousResponses/> |
ohair@286 | 101 | * </wsp:Policy> |
ohair@286 | 102 | * </wsam:Addressing> |
ohair@286 | 103 | * </pre> |
ohair@286 | 104 | * |
ohair@286 | 105 | * <p> |
ohair@286 | 106 | * See <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/"> |
ohair@286 | 107 | * Web Services Addressing - Core</a>, |
ohair@286 | 108 | * <a href="http://www.w3.org/TR/2006/REC-ws-addr-soap-20060509/"> |
ohair@286 | 109 | * Web Services Addressing 1.0 - SOAP Binding</a>, |
ohair@286 | 110 | * and <a href="http://www.w3.org/TR/ws-addr-metadata/"> |
ohair@286 | 111 | * Web Services Addressing 1.0 - Metadata</a> |
ohair@286 | 112 | * for more information on WS-Addressing. |
ohair@286 | 113 | * |
ohair@286 | 114 | * @see Addressing |
ohair@286 | 115 | * @since JAX-WS 2.1 |
ohair@286 | 116 | */ |
ohair@286 | 117 | |
ohair@286 | 118 | public final class AddressingFeature extends WebServiceFeature { |
ohair@286 | 119 | /** |
ohair@286 | 120 | * Constant value identifying the AddressingFeature |
ohair@286 | 121 | */ |
ohair@286 | 122 | public static final String ID = "http://www.w3.org/2005/08/addressing/module"; |
ohair@286 | 123 | |
ohair@286 | 124 | /** |
ohair@286 | 125 | * If addressing is enabled, this property determines whether the endpoint |
ohair@286 | 126 | * requires WS-Addressing. If required is true, WS-Addressing headers MUST |
ohair@286 | 127 | * be present on incoming and outgoing messages. |
ohair@286 | 128 | */ |
alanb@368 | 129 | // should be private final, keeping original modifier due to backwards compatibility |
alanb@368 | 130 | protected boolean required; |
ohair@286 | 131 | |
ohair@286 | 132 | /** |
ohair@286 | 133 | * If addressing is enabled, this property determines if endpoint requires |
ohair@286 | 134 | * the use of only anonymous responses, or only non-anonymous responses, or all. |
ohair@286 | 135 | * |
ohair@286 | 136 | * <p> |
ohair@286 | 137 | * {@link Responses#ALL} supports all response types and this is the default |
ohair@286 | 138 | * value. |
ohair@286 | 139 | * |
ohair@286 | 140 | * <p> |
ohair@286 | 141 | * {@link Responses#ANONYMOUS} requires the use of only anonymous |
ohair@286 | 142 | * responses. It will result into wsam:AnonymousResponses nested assertion |
ohair@286 | 143 | * as specified in |
ohair@286 | 144 | * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicyanonresponses"> |
ohair@286 | 145 | * 3.1.2 AnonymousResponses Assertion</a> in the generated WSDL. |
ohair@286 | 146 | * |
ohair@286 | 147 | * <p> |
ohair@286 | 148 | * {@link Responses#NON_ANONYMOUS} requires the use of only non-anonymous |
ohair@286 | 149 | * responses. It will result into |
ohair@286 | 150 | * wsam:NonAnonymousResponses nested assertion as specified in |
ohair@286 | 151 | * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicynonanonresponses"> |
ohair@286 | 152 | * 3.1.3 NonAnonymousResponses Assertion</a> in the generated WSDL. |
ohair@286 | 153 | * |
ohair@286 | 154 | * @since JAX-WS 2.2 |
ohair@286 | 155 | */ |
ohair@286 | 156 | public enum Responses { |
ohair@286 | 157 | /** |
ohair@286 | 158 | * Specifies the use of only anonymous |
ohair@286 | 159 | * responses. It will result into wsam:AnonymousResponses nested assertion |
ohair@286 | 160 | * as specified in |
ohair@286 | 161 | * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicyanonresponses"> |
ohair@286 | 162 | * 3.1.2 AnonymousResponses Assertion</a> in the generated WSDL. |
ohair@286 | 163 | */ |
ohair@286 | 164 | ANONYMOUS, |
ohair@286 | 165 | |
ohair@286 | 166 | /** |
ohair@286 | 167 | * Specifies the use of only non-anonymous |
ohair@286 | 168 | * responses. It will result into |
ohair@286 | 169 | * wsam:NonAnonymousResponses nested assertion as specified in |
ohair@286 | 170 | * <a href="http://www.w3.org/TR/ws-addr-metadata/#wspolicynonanonresponses"> |
ohair@286 | 171 | * 3.1.3 NonAnonymousResponses Assertion</a> in the generated WSDL. |
ohair@286 | 172 | */ |
ohair@286 | 173 | NON_ANONYMOUS, |
ohair@286 | 174 | |
ohair@286 | 175 | /** |
ohair@286 | 176 | * Supports all response types and this is the default |
ohair@286 | 177 | */ |
ohair@286 | 178 | ALL |
ohair@286 | 179 | } |
ohair@286 | 180 | |
ohair@286 | 181 | private final Responses responses; |
ohair@286 | 182 | |
ohair@286 | 183 | /** |
ohair@286 | 184 | * Creates and configures an <code>AddressingFeature</code> with the |
ohair@286 | 185 | * use of addressing requirements. The created feature enables |
ohair@286 | 186 | * ws-addressing i.e. supports ws-addressing but doesn't require |
ohair@286 | 187 | * its use. It is also configured to accept all the response types. |
ohair@286 | 188 | */ |
ohair@286 | 189 | public AddressingFeature() { |
ohair@286 | 190 | this(true, false, Responses.ALL); |
ohair@286 | 191 | } |
ohair@286 | 192 | |
ohair@286 | 193 | /** |
ohair@286 | 194 | * Creates and configures an <code>AddressingFeature</code> with the |
ohair@286 | 195 | * use of addressing requirements. If <code>enabled</code> is true, |
ohair@286 | 196 | * it enables ws-addressing i.e. supports ws-addressing but doesn't |
ohair@286 | 197 | * require its use. It also configures to accept all the response types. |
ohair@286 | 198 | * |
ohair@286 | 199 | * @param enabled true enables ws-addressing i.e.ws-addressing |
ohair@286 | 200 | * is supported but doesn't require its use |
ohair@286 | 201 | */ |
ohair@286 | 202 | public AddressingFeature(boolean enabled) { |
ohair@286 | 203 | this(enabled, false, Responses.ALL); |
ohair@286 | 204 | } |
ohair@286 | 205 | |
ohair@286 | 206 | /** |
ohair@286 | 207 | * Creates and configures an <code>AddressingFeature</code> with the |
ohair@286 | 208 | * use of addressing requirements. If <code>enabled</code> and |
ohair@286 | 209 | * <code>required</code> are true, it enables ws-addressing and |
ohair@286 | 210 | * requires its use. It also configures to accept all the response types. |
ohair@286 | 211 | * |
ohair@286 | 212 | * @param enabled true enables ws-addressing i.e.ws-addressing |
ohair@286 | 213 | * is supported but doesn't require its use |
ohair@286 | 214 | * @param required true means requires the use of ws-addressing . |
ohair@286 | 215 | */ |
ohair@286 | 216 | public AddressingFeature(boolean enabled, boolean required) { |
ohair@286 | 217 | this(enabled, required, Responses.ALL); |
ohair@286 | 218 | } |
ohair@286 | 219 | |
ohair@286 | 220 | /** |
ohair@286 | 221 | * Creates and configures an <code>AddressingFeature</code> with the |
ohair@286 | 222 | * use of addressing requirements. If <code>enabled</code> and |
ohair@286 | 223 | * <code>required</code> are true, it enables ws-addressing and |
ohair@286 | 224 | * requires its use. Also, the response types can be configured using |
ohair@286 | 225 | * <code>responses</code> parameter. |
ohair@286 | 226 | * |
ohair@286 | 227 | * @param enabled true enables ws-addressing i.e.ws-addressing |
ohair@286 | 228 | * is supported but doesn't require its use |
ohair@286 | 229 | * @param required true means requires the use of ws-addressing . |
ohair@286 | 230 | * @param responses specifies what type of responses are required |
ohair@286 | 231 | * |
ohair@286 | 232 | * @since JAX-WS 2.2 |
ohair@286 | 233 | */ |
ohair@286 | 234 | public AddressingFeature(boolean enabled, boolean required, Responses responses) { |
ohair@286 | 235 | this.enabled = enabled; |
ohair@286 | 236 | this.required = required; |
ohair@286 | 237 | this.responses = responses; |
ohair@286 | 238 | } |
ohair@286 | 239 | |
ohair@286 | 240 | /** |
ohair@286 | 241 | * {@inheritDoc} |
ohair@286 | 242 | */ |
ohair@286 | 243 | public String getID() { |
ohair@286 | 244 | return ID; |
ohair@286 | 245 | } |
ohair@286 | 246 | |
ohair@286 | 247 | /** |
ohair@286 | 248 | * If addressing is enabled, this property determines whether the endpoint |
ohair@286 | 249 | * requires WS-Addressing. If required is true, WS-Addressing headers MUST |
ohair@286 | 250 | * be present on incoming and outgoing messages. |
ohair@286 | 251 | * |
ohair@286 | 252 | * @return the current required value |
ohair@286 | 253 | */ |
ohair@286 | 254 | public boolean isRequired() { |
ohair@286 | 255 | return required; |
ohair@286 | 256 | } |
ohair@286 | 257 | |
ohair@286 | 258 | /** |
ohair@286 | 259 | * If addressing is enabled, this property determines whether endpoint |
ohair@286 | 260 | * requires the use of anonymous responses, or non-anonymous responses, |
ohair@286 | 261 | * or all responses. |
ohair@286 | 262 | * |
ohair@286 | 263 | * <p> |
ohair@286 | 264 | * @return {@link Responses#ALL} when endpoint supports all types of |
ohair@286 | 265 | * responses, |
ohair@286 | 266 | * {@link Responses#ANONYMOUS} when endpoint requires the use of |
ohair@286 | 267 | * only anonymous responses, |
ohair@286 | 268 | * {@link Responses#NON_ANONYMOUS} when endpoint requires the use |
ohair@286 | 269 | * of only non-anonymous responses |
ohair@286 | 270 | * |
ohair@286 | 271 | * @since JAX-WS 2.2 |
ohair@286 | 272 | */ |
ohair@286 | 273 | public Responses getResponses() { |
ohair@286 | 274 | return responses; |
ohair@286 | 275 | } |
ohair@286 | 276 | |
ohair@286 | 277 | } |