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; |
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 |
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 } |