Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, 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 */
26 package com.oracle.webservices.internal.api.message;
28 import java.io.IOException;
29 import java.io.OutputStream;
30 import java.nio.ByteBuffer;
31 import java.nio.channels.WritableByteChannel;
33 import javax.xml.soap.SOAPException;
34 import javax.xml.soap.SOAPMessage;
36 /**
37 * MessageContext represents a container of a SOAP message and all the properties
38 * including the transport headers.
39 *
40 * MessageContext is a composite {@link PropertySet} that combines properties exposed from multiple
41 * {@link PropertySet}s into one.
42 *
43 * <p>
44 * This implementation allows one {@link PropertySet} to assemble
45 * all properties exposed from other "satellite" {@link PropertySet}s.
46 * (A satellite may itself be a {@link DistributedPropertySet}, so
47 * in general this can form a tree.)
48 *
49 * @author shih-chang.chen@oracle.com
50 */
51 public interface MessageContext extends DistributedPropertySet {
52 /**
53 * Gets the SAAJ SOAPMessage representation of the SOAP message.
54 *
55 * @return The SOAPMessage
56 */
57 SOAPMessage getAsSOAPMessage() throws SOAPException;
59 /**
60 * Gets the SAAJ SOAPMessage representation of the SOAP message.
61 * @deprecated use getAsSOAPMessage
62 * @return The SOAPMessage
63 */
64 SOAPMessage getSOAPMessage() throws SOAPException;
66 /**
67 * Writes the XML infoset portion of this MessageContext
68 * (from <soap:Envelope> to </soap:Envelope>).
69 *
70 * @param out
71 * Must not be null. The caller is responsible for closing the stream,
72 * not the callee.
73 *
74 * @return
75 * The MIME content type of the encoded message (such as "application/xml").
76 * This information is often ncessary by transport.
77 *
78 * @throws IOException
79 * if a {@link OutputStream} throws {@link IOException}.
80 */
81 ContentType writeTo( OutputStream out ) throws IOException;
83 /**
84 * The version of {@link #writeTo(OutputStream)}
85 * that writes to NIO {@link ByteBuffer}.
86 *
87 * <p>
88 * TODO: for the convenience of implementation, write
89 * an adapter that wraps {@link WritableByteChannel} to {@link OutputStream}.
90 */
91 // ContentType writeTo( WritableByteChannel buffer );
93 /**
94 * Gets the Content-type of this message. For an out-bound message that this getContentType()
95 * method returns a null, the Content-Type can be determined only by calling the writeTo
96 * method to write the MessageContext to an OutputStream.
97 *
98 * @return The MIME content type of this message
99 */
100 ContentType getContentType();
101 }