1 /*
   2  * Copyright (c) 1997, 2014, 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     public SOAPPart getSOAPPart() {
  80         if (soapPartImpl == null) {
  81             soapPartImpl = new SOAPPart1_1Impl(this);
  82         }
  83         return soapPartImpl;
  84     }
  85 

  86     protected boolean isCorrectSoapVersion(int contentTypeId) {
  87         return (contentTypeId & SOAP1_1_FLAG) != 0;
  88     }
  89 

  90     public String getAction() {
  91         log.log(
  92             Level.SEVERE,
  93             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
  94             new String[] { "Action" });
  95         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
  96     }
  97 

  98     public void setAction(String type) {
  99         log.log(
 100             Level.SEVERE,
 101             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 102             new String[] { "Action" });
 103         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 104     }
 105 

 106     public String getCharset() {
 107         log.log(
 108             Level.SEVERE,
 109             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 110             new String[] { "Charset" });
 111         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 112     }
 113 

 114     public void setCharset(String charset) {
 115         log.log(
 116             Level.SEVERE,
 117             "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
 118             new String[] { "Charset" });
 119         throw new UnsupportedOperationException("Operation not supported by SOAP 1.1");
 120     }
 121 

 122     protected String getExpectedContentType() {
 123         return isFastInfoset ? "application/fastinfoset" : "text/xml";
 124     }
 125 

 126    protected String getExpectedAcceptHeader() {
 127        String accept = "text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
 128        return acceptFastInfoset ? ("application/fastinfoset, " + accept) : accept;
 129    }
 130 
 131 }
--- EOF ---