001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: /*
021: * $Id: Message1_1Impl.java,v 1.2 2007/07/16 16:41:24 ofung Exp $
022: */
023:
024: /*
025: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
026: *
027: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
028: *
029: * The contents of this file are subject to the terms of either the GNU
030: * General Public License Version 2 only ("GPL") or the Common Development
031: * and Distribution License("CDDL") (collectively, the "License"). You
032: * may not use this file except in compliance with the License. You can obtain
033: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
034: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
035: * language governing permissions and limitations under the License.
036: *
037: * When distributing the software, include this License Header Notice in each
038: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
039: * Sun designates this particular file as subject to the "Classpath" exception
040: * as provided by Sun in the GPL Version 2 section of the License file that
041: * accompanied this code. If applicable, add the following below the License
042: * Header, with the fields enclosed by brackets [] replaced by your own
043: * identifying information: "Portions Copyrighted [year]
044: * [name of copyright owner]"
045: *
046: * Contributor(s):
047: *
048: * If you wish your version of this file to be governed by only the CDDL or
049: * only the GPL Version 2, indicate your decision by adding "[Contributor]
050: * elects to include this software in this distribution under the [CDDL or GPL
051: * Version 2] license." If you don't indicate a single choice of license, a
052: * recipient has the option to distribute your version of this file under
053: * either the CDDL, the GPL Version 2 or to extend the choice of license to
054: * its licensees as provided above. However, if you add GPL Version 2 code
055: * and therefore, elected the GPL Version 2 license, then the option applies
056: * only if the new code is made subject to such option by the copyright
057: * holder.
058: */
059:
060: /**
061: *
062: * @author SAAJ RI Development Team
063: */package com.sun.xml.messaging.saaj.soap.ver1_1;
064:
065: import java.io.IOException;
066: import java.io.InputStream;
067: import java.util.logging.Level;
068: import java.util.logging.Logger;
069:
070: import javax.xml.soap.*;
071:
072: import com.sun.xml.messaging.saaj.SOAPExceptionImpl;
073: import com.sun.xml.messaging.saaj.packaging.mime.internet.ContentType;
074: import com.sun.xml.messaging.saaj.soap.MessageImpl;
075: import com.sun.xml.messaging.saaj.util.LogDomainConstants;
076:
077: public class Message1_1Impl extends MessageImpl implements
078: SOAPConstants {
079:
080: protected static Logger log = Logger.getLogger(
081: LogDomainConstants.SOAP_VER1_1_DOMAIN,
082: "com.sun.xml.messaging.saaj.soap.ver1_1.LocalStrings");
083:
084: public Message1_1Impl() {
085: super ();
086: }
087:
088: public Message1_1Impl(boolean isFastInfoset,
089: boolean acceptFastInfoset) {
090: super (isFastInfoset, acceptFastInfoset);
091: }
092:
093: public Message1_1Impl(SOAPMessage msg) {
094: super (msg);
095: }
096:
097: // unused. can we delete this? - Kohsuke
098: public Message1_1Impl(MimeHeaders headers, InputStream in)
099: throws IOException, SOAPExceptionImpl {
100: super (headers, in);
101: }
102:
103: public Message1_1Impl(MimeHeaders headers, ContentType ct,
104: int stat, InputStream in) throws SOAPExceptionImpl {
105: super (headers, ct, stat, in);
106: }
107:
108: public SOAPPart getSOAPPart() {
109: if (soapPart == null) {
110: soapPart = new SOAPPart1_1Impl(this );
111: }
112: return soapPart;
113: }
114:
115: protected boolean isCorrectSoapVersion(int contentTypeId) {
116: return (contentTypeId & SOAP1_1_FLAG) != 0;
117: }
118:
119: public String getAction() {
120: log.log(Level.SEVERE,
121: "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
122: new String[] { "Action" });
123: throw new UnsupportedOperationException(
124: "Operation not supported by SOAP 1.1");
125: }
126:
127: public void setAction(String type) {
128: log.log(Level.SEVERE,
129: "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
130: new String[] { "Action" });
131: throw new UnsupportedOperationException(
132: "Operation not supported by SOAP 1.1");
133: }
134:
135: public String getCharset() {
136: log.log(Level.SEVERE,
137: "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
138: new String[] { "Charset" });
139: throw new UnsupportedOperationException(
140: "Operation not supported by SOAP 1.1");
141: }
142:
143: public void setCharset(String charset) {
144: log.log(Level.SEVERE,
145: "SAAJ0303.ver1_1.msg.op.unsupported.in.SOAP1.1",
146: new String[] { "Charset" });
147: throw new UnsupportedOperationException(
148: "Operation not supported by SOAP 1.1");
149: }
150:
151: protected String getExpectedContentType() {
152: return isFastInfoset ? "application/fastinfoset" : "text/xml";
153: }
154:
155: protected String getExpectedAcceptHeader() {
156: String accept = "text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
157: return acceptFastInfoset ? ("application/fastinfoset, " + accept)
158: : accept;
159: }
160:
161: }
|