1 /*
   2  * Copyright (c) 1997, 2017, 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 /**
  27 *
  28 * @author SAAJ RI Development Team
  29 */
  30 package com.sun.xml.internal.messaging.saaj.soap.ver1_1;
  31 
  32 import java.io.IOException;
  33 import java.io.InputStream;
  34 import java.util.logging.Level;
  35 import java.util.logging.Logger;
  36 
  37 import javax.xml.soap.*;
  38 import javax.xml.stream.XMLStreamReader;
  39 
  40 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
  41 import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
  42 import com.sun.xml.internal.messaging.saaj.soap.MessageImpl;
  43 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
  44 
  45 public class Message1_1Impl extends MessageImpl implements SOAPConstants {
  46 
  47     protected static final Logger log =
  48         Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN,
  49                          "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings");
  50 
  51     public Message1_1Impl() {
  52         super();
  53     }
  54 
  55     public Message1_1Impl(boolean isFastInfoset, boolean acceptFastInfoset) {
  56         super(isFastInfoset, acceptFastInfoset);
  57     }
  58 
  59     public Message1_1Impl(SOAPMessage msg) {
  60         super(msg);
  61     }
  62 
  63     // unused. can we delete this? - Kohsuke
  64     public Message1_1Impl(MimeHeaders headers, InputStream in)
  65         throws IOException, SOAPExceptionImpl {
  66         super(headers, in);
  67     }
  68 
  69     public Message1_1Impl(MimeHeaders headers, ContentType ct, int stat, InputStream in)
  70         throws SOAPExceptionImpl {
  71         super(headers,ct,stat,in);
  72     }
  73 
  74     public Message1_1Impl(MimeHeaders headers, ContentType ct, int stat, XMLStreamReader reader)
  75             throws SOAPExceptionImpl {
  76             super(headers,ct,stat,reader);
  77     }
  78 
  79     @Override
  80     public SOAPPart getSOAPPart() {
  81         if (soapPartImpl == null) {
  82             soapPartImpl = new SOAPPart1_1Impl(this);
  83         }
  84         return soapPartImpl;
  85     }
  86 
  87     @Override
  88     protected boolean isCorrectSoapVersion(int contentTypeId) {
  89         return (contentTypeId & SOAP1_1_FLAG) != 0;
  90     }
  91 
  92     @Override
  93     public String getAction() {
  94         log.log(
  95             Level.SEVERE,
  96             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
  97             new String[] { "Action" });
  98         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
  99     }
 100 
 101     @Override
 102     public void setAction(String type) {
 103         log.log(
 104             Level.SEVERE,
 105             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 106             new String[] { "Action" });
 107         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 108     }
 109 
 110     @Override
 111     public String getCharset() {
 112         log.log(
 113             Level.SEVERE,
 114             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 115             new String[] { "Charset" });
 116         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 117     }
 118 
 119     @Override
 120     public void setCharset(String charset) {
 121         log.log(
 122             Level.SEVERE,
 123             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 124             new String[] { "Charset" });
 125         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 126     }
 127 
 128     @Override
 129     protected String getExpectedContentType() {
 130         return isFastInfoset ? "application/fastinfoset" : "text/xml";
 131     }
 132 
 133     @Override
 134    protected String getExpectedAcceptHeader() {
 135        String accept = "text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
 136        return acceptFastInfoset ? ("application/fastinfoset, " + accept) : accept;
 137    }
 138 
 139 }
--- EOF ---