001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package com.sun.xml.internal.ws.spi.runtime;
026:
027: import java.io.InputStream;
028: import java.io.OutputStream;
029: import java.util.List;
030: import java.util.Map;
031:
032: /**
033: * Captures many transports that are used to talk with WS endpoints.
034: *
035: * For endpoints deployed in light weight http server in J2SE, the implemenation
036: * of this class uses HttpTransaction to read from or write to stream.
037: *
038: * For endpoints deployed in servlet container, the implementation of this
039: * class uses HttpServletRequest to read a request, and uses HttpServletResponse
040: * to write response.
041: *
042: * This also works for local transport, JMS transport.
043: *
044: * Runtime can access to the implementation of this interface using
045: * messageInfo.getConnection()
046: *
047: */
048:
049: public interface WSConnection {
050:
051: public static final int OK = 200;
052: public static final int ONEWAY = 202;
053: public static final int UNSUPPORTED_MEDIA = 415;
054: public static final int MALFORMED_XML = 400;
055: public static final int INTERNAL_ERR = 500;
056:
057: /**
058: * returns transport headers
059: * @return transport headers
060: */
061: public Map<String, List<String>> getHeaders();
062:
063: /**
064: * sets transport headers
065: */
066: public void setHeaders(Map<String, List<String>> headers);
067:
068: /**
069: * sets the transport status code like <code>OK</code>
070: */
071: public void setStatus(int status);
072:
073: /**
074: * @return return the status code
075: */
076: public int getStatus();
077:
078: /**
079: * Transport's underlying input stream
080: * @return Transport's underlying input stream
081: */
082: public InputStream getInput();
083:
084: /**
085: * Closes transport's input stream
086: */
087: public void closeInput();
088:
089: /**
090: * Transport's underlying output stream
091: * @return Transport's underlying output stream
092: */
093: public OutputStream getOutput();
094:
095: /**
096: * Closes transport's output stream
097: */
098: public void closeOutput();
099:
100: public OutputStream getDebug();
101:
102: /**
103: * Closes transport connection
104: */
105: public void close();
106:
107: }
|