alanb@368: /* katleman@374: * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. katleman@374: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. alanb@368: * katleman@374: * This code is free software; you can redistribute it and/or modify it katleman@374: * under the terms of the GNU General Public License version 2 only, as katleman@374: * published by the Free Software Foundation. Oracle designates this katleman@374: * particular file as subject to the "Classpath" exception as provided katleman@374: * by Oracle in the LICENSE file that accompanied this code. alanb@368: * katleman@374: * This code is distributed in the hope that it will be useful, but WITHOUT katleman@374: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or katleman@374: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License katleman@374: * version 2 for more details (a copy is included in the LICENSE file that katleman@374: * accompanied this code). alanb@368: * katleman@374: * You should have received a copy of the GNU General Public License version katleman@374: * 2 along with this work; if not, write to the Free Software Foundation, katleman@374: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. alanb@368: * katleman@374: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA katleman@374: * or visit www.oracle.com if you need additional information or have any katleman@374: * questions. alanb@368: */ alanb@368: alanb@368: package com.oracle.webservices.internal.api.message; alanb@368: alanb@368: import java.io.IOException; alanb@368: import java.io.OutputStream; alanb@368: import java.nio.ByteBuffer; alanb@368: import java.nio.channels.WritableByteChannel; alanb@368: alanb@368: import javax.xml.soap.SOAPException; alanb@368: import javax.xml.soap.SOAPMessage; alanb@368: alanb@368: /** alanb@368: * MessageContext represents a container of a SOAP message and all the properties alanb@368: * including the transport headers. alanb@368: * alanb@368: * MessageContext is a composite {@link PropertySet} that combines properties exposed from multiple alanb@368: * {@link PropertySet}s into one. alanb@368: * alanb@368: *

alanb@368: * This implementation allows one {@link PropertySet} to assemble alanb@368: * all properties exposed from other "satellite" {@link PropertySet}s. alanb@368: * (A satellite may itself be a {@link DistributedPropertySet}, so alanb@368: * in general this can form a tree.) alanb@368: * alanb@368: * @author shih-chang.chen@oracle.com alanb@368: */ alanb@368: public interface MessageContext extends DistributedPropertySet { alanb@368: /** alanb@368: * Gets the SAAJ SOAPMessage representation of the SOAP message. alanb@368: * alanb@368: * @return The SOAPMessage alanb@368: */ alanb@368: SOAPMessage getAsSOAPMessage() throws SOAPException; alanb@368: alanb@368: /** alanb@368: * Gets the SAAJ SOAPMessage representation of the SOAP message. alanb@368: * @deprecated use getAsSOAPMessage alanb@368: * @return The SOAPMessage alanb@368: */ alanb@368: SOAPMessage getSOAPMessage() throws SOAPException; alanb@368: alanb@368: /** alanb@368: * Writes the XML infoset portion of this MessageContext alanb@368: * (from <soap:Envelope> to </soap:Envelope>). alanb@368: * alanb@368: * @param out alanb@368: * Must not be null. The caller is responsible for closing the stream, alanb@368: * not the callee. alanb@368: * alanb@368: * @return alanb@368: * The MIME content type of the encoded message (such as "application/xml"). alanb@368: * This information is often ncessary by transport. alanb@368: * alanb@368: * @throws IOException alanb@368: * if a {@link OutputStream} throws {@link IOException}. alanb@368: */ alanb@368: ContentType writeTo( OutputStream out ) throws IOException; alanb@368: alanb@368: /** alanb@368: * The version of {@link #writeTo(OutputStream)} alanb@368: * that writes to NIO {@link ByteBuffer}. alanb@368: * alanb@368: *

alanb@368: * TODO: for the convenience of implementation, write alanb@368: * an adapter that wraps {@link WritableByteChannel} to {@link OutputStream}. alanb@368: */ alanb@368: // ContentType writeTo( WritableByteChannel buffer ); alanb@368: alanb@368: /** alanb@368: * Gets the Content-type of this message. For an out-bound message that this getContentType() alanb@368: * method returns a null, the Content-Type can be determined only by calling the writeTo alanb@368: * method to write the MessageContext to an OutputStream. alanb@368: * alanb@368: * @return The MIME content type of this message alanb@368: */ alanb@368: ContentType getContentType(); alanb@368: }