src/share/jaxws_classes/com/sun/xml/internal/ws/api/BindingID.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 1997, 2011, 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
33 import com.sun.xml.internal.ws.binding.SOAPBindingImpl; 33 import com.sun.xml.internal.ws.binding.SOAPBindingImpl;
34 import com.sun.xml.internal.ws.binding.WebServiceFeatureList; 34 import com.sun.xml.internal.ws.binding.WebServiceFeatureList;
35 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec; 35 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
36 import com.sun.xml.internal.ws.encoding.XMLHTTPBindingCodec; 36 import com.sun.xml.internal.ws.encoding.XMLHTTPBindingCodec;
37 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants; 37 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
38 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
39 import com.sun.xml.internal.ws.util.ServiceFinder; 38 import com.sun.xml.internal.ws.util.ServiceFinder;
40 import com.sun.xml.internal.ws.developer.JAXWSProperties; 39 import com.sun.xml.internal.ws.developer.JAXWSProperties;
41 import static com.sun.xml.internal.ws.binding.WebServiceFeatureList.toFeatureArray;
42 40
43 import javax.xml.ws.BindingType; 41 import javax.xml.ws.BindingType;
44 import javax.xml.ws.WebServiceException; 42 import javax.xml.ws.WebServiceException;
45 import javax.xml.ws.WebServiceFeature; 43 import javax.xml.ws.WebServiceFeature;
46 import javax.xml.ws.handler.Handler; 44 import javax.xml.ws.handler.Handler;
155 * (such as SOAP1.1, SOAP1.2, REST, ...) 153 * (such as SOAP1.1, SOAP1.2, REST, ...)
156 * 154 *
157 * @return 155 * @return
158 * Always non-null same value. 156 * Always non-null same value.
159 */ 157 */
158 @Override
160 public abstract String toString(); 159 public abstract String toString();
161 160
162 /** 161 /**
163 * Returna a new {@link WebServiceFeatureList} instance 162 * Returna a new {@link WebServiceFeatureList} instance
164 * that represents the features that are built into this binding ID. 163 * that represents the features that are built into this binding ID.
216 } 215 }
217 216
218 /** 217 /**
219 * Compares the equality based on {@link #toString()}. 218 * Compares the equality based on {@link #toString()}.
220 */ 219 */
220 @Override
221 public boolean equals(Object obj) { 221 public boolean equals(Object obj) {
222 if(!(obj instanceof BindingID)) 222 if(!(obj instanceof BindingID))
223 return false; 223 return false;
224 return toString().equals(obj.toString()); 224 return toString().equals(obj.toString());
225 } 225 }
226 226
227 @Override
227 public int hashCode() { 228 public int hashCode() {
228 return toString().hashCode(); 229 return toString().hashCode();
229 } 230 }
230 231
231 /** 232 /**
351 352
352 /** 353 /**
353 * Constant that represents REST. 354 * Constant that represents REST.
354 */ 355 */
355 public static final BindingID XML_HTTP = new Impl(SOAPVersion.SOAP_11, HTTPBinding.HTTP_BINDING,false) { 356 public static final BindingID XML_HTTP = new Impl(SOAPVersion.SOAP_11, HTTPBinding.HTTP_BINDING,false) {
357 @Override
356 public Codec createEncoder(WSBinding binding) { 358 public Codec createEncoder(WSBinding binding) {
357 return new XMLHTTPBindingCodec(binding.getFeatures()); 359 return new XMLHTTPBindingCodec(binding.getFeatures());
358 } 360 }
359 }; 361 };
360 362
361 /** 363 /**
362 * Constant that represents REST. 364 * Constant that represents REST.
363 */ 365 */
364 private static final BindingID REST_HTTP = new Impl(SOAPVersion.SOAP_11, JAXWSProperties.REST_BINDING,true) { 366 private static final BindingID REST_HTTP = new Impl(SOAPVersion.SOAP_11, JAXWSProperties.REST_BINDING,true) {
367 @Override
365 public Codec createEncoder(WSBinding binding) { 368 public Codec createEncoder(WSBinding binding) {
366 return new XMLHTTPBindingCodec(binding.getFeatures()); 369 return new XMLHTTPBindingCodec(binding.getFeatures());
367 } 370 }
368 }; 371 };
369 372
376 this.version = version; 379 this.version = version;
377 this.lexical = lexical; 380 this.lexical = lexical;
378 this.canGenerateWSDL = canGenerateWSDL; 381 this.canGenerateWSDL = canGenerateWSDL;
379 } 382 }
380 383
384 @Override
381 public SOAPVersion getSOAPVersion() { 385 public SOAPVersion getSOAPVersion() {
382 return version; 386 return version;
383 } 387 }
384 388
389 @Override
385 public String toString() { 390 public String toString() {
386 return lexical; 391 return lexical;
387 } 392 }
388 393
389 @Deprecated 394 @Deprecated
395 @Override
390 public boolean canGenerateWSDL() { 396 public boolean canGenerateWSDL() {
391 return canGenerateWSDL; 397 return canGenerateWSDL;
392 } 398 }
393 } 399 }
394 400
397 */ 403 */
398 private static final class SOAPHTTPImpl extends Impl implements Cloneable { 404 private static final class SOAPHTTPImpl extends Impl implements Cloneable {
399 /*final*/ Map<String,String> parameters = new HashMap<String,String>(); 405 /*final*/ Map<String,String> parameters = new HashMap<String,String>();
400 406
401 static final String MTOM_PARAM = "mtom"; 407 static final String MTOM_PARAM = "mtom";
402 Boolean mtomSetting = null;
403 408
404 public SOAPHTTPImpl(SOAPVersion version, String lexical, boolean canGenerateWSDL) { 409 public SOAPHTTPImpl(SOAPVersion version, String lexical, boolean canGenerateWSDL) {
405 super(version, lexical, canGenerateWSDL); 410 super(version, lexical, canGenerateWSDL);
406 } 411 }
407 412
408 public SOAPHTTPImpl(SOAPVersion version, String lexical, boolean canGenerateWSDL, 413 public SOAPHTTPImpl(SOAPVersion version, String lexical, boolean canGenerateWSDL,
409 boolean mtomEnabled) { 414 boolean mtomEnabled) {
410 this(version, lexical, canGenerateWSDL); 415 this(version, lexical, canGenerateWSDL);
411 String mtomStr = mtomEnabled ? "true" : "false"; 416 String mtomStr = mtomEnabled ? "true" : "false";
412 parameters.put(MTOM_PARAM, mtomStr); 417 parameters.put(MTOM_PARAM, mtomStr);
413 mtomSetting = mtomEnabled; 418 }
414 } 419
415 420 public @NotNull @Override Codec createEncoder(WSBinding binding) {
416 public @NotNull Codec createEncoder(WSBinding binding) {
417 return new SOAPBindingCodec(binding.getFeatures()); 421 return new SOAPBindingCodec(binding.getFeatures());
418 } 422 }
419 423
420 private Boolean isMTOMEnabled() { 424 private Boolean isMTOMEnabled() {
421 String mtom = parameters.get(MTOM_PARAM); 425 String mtom = parameters.get(MTOM_PARAM);
422 return mtom==null?null:Boolean.valueOf(mtom); 426 return mtom==null?null:Boolean.valueOf(mtom);
423 } 427 }
424 428
429 @Override
425 public WebServiceFeatureList createBuiltinFeatureList() { 430 public WebServiceFeatureList createBuiltinFeatureList() {
426 WebServiceFeatureList r=super.createBuiltinFeatureList(); 431 WebServiceFeatureList r=super.createBuiltinFeatureList();
427 Boolean mtom = isMTOMEnabled(); 432 Boolean mtom = isMTOMEnabled();
428 if(mtom != null) 433 if(mtom != null)
429 r.add(new MTOMFeature(mtom)); 434 r.add(new MTOMFeature(mtom));
430 return r; 435 return r;
431 } 436 }
432 437
438 @Override
433 public String getParameter(String parameterName, String defaultValue) { 439 public String getParameter(String parameterName, String defaultValue) {
434 if (parameters.get(parameterName) == null) 440 if (parameters.get(parameterName) == null)
435 return super.getParameter(parameterName, defaultValue); 441 return super.getParameter(parameterName, defaultValue);
436 return parameters.get(parameterName); 442 return parameters.get(parameterName);
437 } 443 }
444
445 @Override
446 public SOAPHTTPImpl clone() throws CloneNotSupportedException {
447 return (SOAPHTTPImpl) super.clone();
448 }
438 } 449 }
439 } 450 }

mercurial