1 /* 2 * Copyright (c) 1997, 2013, 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 */ 25 26 package com.sun.xml.internal.ws.encoding; 27 28 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer; 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; 32 import com.sun.xml.internal.ws.api.message.Header; 33 import com.sun.xml.internal.ws.api.message.Packet; 34 import com.sun.xml.internal.ws.api.pipe.ContentType; 35 import com.sun.xml.internal.ws.message.stream.StreamHeader11; 36 37 import javax.xml.stream.XMLStreamReader; 38 import java.util.Collections; 39 import java.util.List; 40 41 /** 42 * {@link StreamSOAPCodec} for SOAP 1.1. 43 * 44 * @author Paul.Sandoz@Sun.Com 45 */ 46 final class StreamSOAP11Codec extends StreamSOAPCodec { 47 48 public static final String SOAP11_MIME_TYPE = "text/xml"; 49 public static final String DEFAULT_SOAP11_CONTENT_TYPE = 50 SOAP11_MIME_TYPE+"; charset="+SOAPBindingCodec.DEFAULT_ENCODING; 51 52 private static final List<String> EXPECTED_CONTENT_TYPES = Collections.singletonList(SOAP11_MIME_TYPE); 53 54 /*package*/ StreamSOAP11Codec() { 55 super(SOAPVersion.SOAP_11); 56 } 57 58 /*package*/ StreamSOAP11Codec(WSBinding binding) { 59 super(binding); 60 } 61 62 /*package*/ StreamSOAP11Codec(WSFeatureList features) { 63 super(features); 64 } 65 66 public String getMimeType() { 67 return SOAP11_MIME_TYPE; 68 } 69 70 @Override 71 protected ContentType getContentType(Packet packet) { 72 ContentTypeImpl.Builder b = getContenTypeBuilder(packet); 73 b.soapAction = packet.soapAction; 74 return b.build(); 75 } 76 77 @Override 78 protected String getDefaultContentType() { 79 return DEFAULT_SOAP11_CONTENT_TYPE; 80 } 81 82 protected List<String> getExpectedContentTypes() { 83 return EXPECTED_CONTENT_TYPES; 84 } 85 }