Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
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.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.ws.api.pipe;
28 import com.sun.istack.internal.NotNull;
29 import com.sun.xml.internal.ws.api.SOAPVersion;
30 import com.sun.xml.internal.ws.api.WSBinding;
31 import com.sun.xml.internal.ws.api.WSFeatureList;
33 /**
34 * Factory methods for some of the {@link Codec} implementations.
35 *
36 * <p>
37 * This class provides methods to create codecs for SOAP/HTTP binding.
38 * It allows to replace default SOAP envelope(primary part in MIME message)
39 * codec in the whole Codec.
40 *
41 * <p>
42 * This is a part of the JAX-WS RI internal API so that
43 * {@link Tube} and transport implementations can reuse the implementations
44 * done inside the JAX-WS.
45 *
46 * @author Jitendra Kotamraju
47 * @author Kohsuke Kawaguchi
48 */
49 public abstract class Codecs {
51 /**
52 * This creates a full {@link Codec} for SOAP binding.
53 *
54 * @param feature the WebServiceFeature objects
55 * @return non null codec to parse entire SOAP message(including MIME parts)
56 */
57 public static @NotNull SOAPBindingCodec createSOAPBindingCodec(WSFeatureList feature) {
58 return new com.sun.xml.internal.ws.encoding.SOAPBindingCodec(feature);
59 }
61 /**
62 * This creates a full {@link Codec} for XML binding.
63 *
64 * @param feature the WebServiceFeature objects
65 * @return non null codec to parse entire XML message.
66 */
67 public static @NotNull Codec createXMLCodec(WSFeatureList feature) {
68 return new com.sun.xml.internal.ws.encoding.XMLHTTPBindingCodec(feature);
69 }
72 /**
73 * This creates a full {@link Codec} for SOAP binding using the primary
74 * XML codec argument. The codec argument is used to encode/decode SOAP envelopes
75 * while the returned codec is responsible for encoding/decoding the whole
76 * message.
77 *
78 * <p>
79 * Creates codecs can be set during the {@link Tube}line assembly process.
80 *
81 * @see ServerTubeAssemblerContext#setCodec(Codec)
82 * @see ClientTubeAssemblerContext#setCodec(Codec)
83 *
84 * @param binding binding of the webservice
85 * @param xmlEnvelopeCodec SOAP envelope codec
86 * @return non null codec to parse entire SOAP message(including MIME parts)
87 */
88 public static @NotNull SOAPBindingCodec createSOAPBindingCodec(WSBinding binding, StreamSOAPCodec xmlEnvelopeCodec) {
89 return new com.sun.xml.internal.ws.encoding.SOAPBindingCodec(binding.getFeatures(), xmlEnvelopeCodec);
90 }
92 /**
93 * Creates a default {@link Codec} that can be used to used to
94 * decode XML infoset in SOAP envelope(primary part in MIME message). New codecs
95 * can be written using this codec as delegate.
96 *
97 * @param version SOAP version of the binding
98 * @return non null default xml codec
99 */
100 public static @NotNull
101 StreamSOAPCodec createSOAPEnvelopeXmlCodec(@NotNull SOAPVersion version) {
102 return com.sun.xml.internal.ws.encoding.StreamSOAPCodec.create(version);
103 }
105 /**
106 * Creates a default {@link Codec} that can be used to used to
107 * decode XML infoset in SOAP envelope(primary part in MIME message).
108 * New codecs can be written using this codec as delegate. WSBinding
109 * parameter is used to get SOAP version and features.
110 *
111 * @param binding SOAP version and features are used from this binding
112 * @return non null default xml codec
113 *
114 * @deprecated use {@link #createSOAPEnvelopeXmlCodec(WSFeatureList)}
115 */
116 public static @NotNull StreamSOAPCodec createSOAPEnvelopeXmlCodec(@NotNull WSBinding binding) {
117 return com.sun.xml.internal.ws.encoding.StreamSOAPCodec.create(binding);
118 }
120 /**
121 * Creates a default {@link Codec} that can be used to used to
122 * decode XML infoset in SOAP envelope(primary part in MIME message).
123 * New codecs can be written using this codec as delegate. WSFeatureList
124 * parameter is used to get SOAP version and features.
125 *
126 * @param features SOAP version and features are used from this WSFeatureList
127 * @return non null default xml codec
128 */
129 public static @NotNull StreamSOAPCodec createSOAPEnvelopeXmlCodec(@NotNull WSFeatureList features) {
130 return com.sun.xml.internal.ws.encoding.StreamSOAPCodec.create(features);
131 }
132 }