src/share/classes/com/sun/xml/internal/messaging/saaj/soap/ver1_1/SOAPPart1_1Impl.java

Mon, 04 May 2009 21:10:41 -0700

author
tbell
date
Mon, 04 May 2009 21:10:41 -0700
changeset 50
42dfec6871f6
parent 45
31822b475baa
child 78
860b95cc8d1d
permissions
-rw-r--r--

6658158: Mutable statics in SAAJ (findbugs)
6658163: txw2.DatatypeWriter.BUILDIN is a mutable static (findbugs)
Reviewed-by: darcy

     1 /*
     2  * Copyright 2005-2006 Sun Microsystems, Inc.  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.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    25 /*
    26  *
    27  */
    31 /**
    32 *
    33 * @author SAAJ RI Development Team
    34 */
    35 package com.sun.xml.internal.messaging.saaj.soap.ver1_1;
    37 import java.util.logging.Level;
    38 import java.util.logging.Logger;
    40 import javax.xml.soap.SOAPConstants;
    41 import javax.xml.soap.SOAPException;
    42 import javax.xml.transform.Source;
    44 import com.sun.xml.internal.messaging.saaj.soap.*;
    45 import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
    46 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
    47 import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser;
    49 public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants {
    51     protected static final Logger log =
    52         Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN,
    53                          "com.sun.xml.internal.messaging.saaj.soap.ver1_1.LocalStrings");
    55     public SOAPPart1_1Impl() {
    56         super();
    57      }
    59     public SOAPPart1_1Impl(MessageImpl message) {
    60         super(message);
    61     }
    63     protected String getContentType() {
    64         return isFastInfoset() ? "application/fastinfoset" : "text/xml";
    65     }
    67     protected Envelope createEnvelopeFromSource() throws SOAPException {
    68         // Record the presence of xml declaration before the envelope gets
    69         // created.
    70         XMLDeclarationParser parser = lookForXmlDecl();
    71         Source tmp = source;
    72         source = null;
    73         EnvelopeImpl envelope =
    74             (EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this);
    76         if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) {
    77             log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1");
    78             throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message");
    79         }
    81         if (!omitXmlDecl) {
    82             envelope.setOmitXmlDecl("no");
    83             envelope.setXmlDecl(parser.getXmlDeclaration());
    84             envelope.setCharsetEncoding(parser.getEncoding());
    85         }
    86         return envelope;
    87     }
    89     protected Envelope createEmptyEnvelope(String prefix)
    90         throws SOAPException {
    91         return new Envelope1_1Impl(getDocument(), prefix, true, true);
    92     }
    94     protected SOAPPartImpl duplicateType() {
    95         return new SOAPPart1_1Impl();
    96     }
    98 }

mercurial