001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.webservices;
017:
018: import java.io.IOException;
019: import java.io.InputStream;
020: import java.io.OutputStream;
021: import java.io.Serializable;
022: import java.net.URI;
023: import java.util.Map;
024:
025: /**
026: * @version $Rev: 504138 $ $Date: 2007-02-06 05:51:47 -0800 (Tue, 06 Feb 2007) $
027: */
028: public interface WebServiceContainer extends Serializable {
029:
030: /**
031: * Used when this WebServiceContainer is servicing a POJO, in which case
032: * the pojo instance is held by the enclosing servlet/invoker and passed in
033: * the Request instance to the container.
034: */
035: public static final String POJO_INSTANCE = WebServiceContainer.class
036: .getName()
037: + "@pojoInstance";
038:
039: /**
040: * Used when this WebServiceContainer is servicing a POJO implementing the
041: * ServiceLifecycle interface, in which case the WebServiceContainer is expected
042: * to put the JAX-RPC MessageContext it creates in the Request instance.
043: */
044: public static final String MESSAGE_CONTEXT = WebServiceContainer.class
045: .getName()
046: + "@MessageContext";
047:
048: /**
049: * Used for JAX-WS MessageContext. MessageContext must expose HttpServletRequest.
050: */
051: public static final String SERVLET_REQUEST = WebServiceContainer.class
052: .getName()
053: + "@ServletRequest";
054:
055: /**
056: * Used for JAX-WS MessageContext. MessageContext must expose HttpServletResponse.
057: */
058: public static final String SERVLET_RESPONSE = WebServiceContainer.class
059: .getName()
060: + "@ServletResponse";
061:
062: /**
063: * Used for JAX-WS MessageContext. MessageContext must expose ServletContext.
064: */
065: public static final String SERVLET_CONTEXT = WebServiceContainer.class
066: .getName()
067: + "@ServletContext";
068:
069: /**
070: * Token inserted into wsdl where location should be replaced with the real location
071: */
072: public String LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
073:
074: void invoke(Request request, Response response) throws Exception;
075:
076: void getWsdl(Request req, Response res) throws Exception;
077:
078: void destroy();
079:
080: public interface Request {
081: /** the HTTP OPTIONS type */
082: int OPTIONS = 0; // Section 9.2
083: /** the HTTP GET type */
084: int GET = 1; // Section 9.3
085: /** the HTTP HEAD type */
086: int HEAD = 2; // Section 9.4
087: /** the HTTP POST type */
088: int POST = 3; // Section 9.5
089: /** the HTTP PUT type */
090: int PUT = 4; // Section 9.6
091: /** the HTTP DELETE type */
092: int DELETE = 5; // Section 9.7
093: /** the HTTP TRACE type */
094: int TRACE = 6; // Section 9.8
095: /** the HTTP CONNECT type */
096: int CONNECT = 7; // Section 9.9
097: /** the HTTP UNSUPPORTED type */
098: int UNSUPPORTED = 8;
099: /** the Accept header */
100: String HEADER_ACCEPT = "Accept";
101: /** the Accept-Encoding header */
102: String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
103: /** the Accept-Language header */
104: String HEADER_ACCEPT_LANGUAGE = "Accept-Language";
105: /** the Content-Type header */
106: String HEADER_CONTENT_TYPE = "Content-Type";
107: /** the Content-Length header */
108: String HEADER_CONTENT_LENGTH = "Content-Length";
109: /** the Connection header */
110: String HEADER_CONNECTION = "Connection";
111: /** the Cache-Control header */
112: String HEADER_CACHE_CONTROL = "Cache-Control";
113: /** the Host header */
114: String HEADER_HOST = "Host";
115: /** the User-Agent header */
116: String HEADER_USER_AGENT = "User-Agent";
117: /** the Set-Cookie header */
118: String HEADER_SET_COOKIE = "Set-Cookie";
119: /** the Cookie header */
120: String HEADER_COOKIE = "Cookie";
121:
122: String getHeader(String name);
123:
124: URI getURI();
125:
126: int getContentLength();
127:
128: String getContentType();
129:
130: InputStream getInputStream() throws IOException;
131:
132: int getMethod();
133:
134: String getParameter(String name);
135:
136: Map getParameters();
137:
138: Object getAttribute(String name);
139:
140: void setAttribute(String name, Object value);
141:
142: java.lang.String getRemoteAddr();
143:
144: java.lang.String getContextPath();
145: }
146:
147: public interface Response {
148: void setHeader(String name, String value);
149:
150: String getHeader(String name);
151:
152: OutputStream getOutputStream();
153:
154: void setStatusCode(int code);
155:
156: int getStatusCode();
157:
158: void setContentType(String type);
159:
160: String getContentType();
161:
162: void setStatusMessage(String responseString);
163:
164: void flushBuffer() throws java.io.IOException;
165: }
166:
167: }
|