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     */
017    package org.apache.geronimo.webservices;
018    
019    import java.io.IOException;
020    import java.io.InputStream;
021    import java.io.OutputStream;
022    import java.io.Serializable;
023    import java.net.URI;
024    import java.util.Map;
025    
026    /**
027     * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
028     */
029    public interface WebServiceContainer extends Serializable {
030    
031        /**
032         * Used when this WebServiceContainer is servicing a POJO, in which case
033         * the pojo instance is held by the enclosing servlet/invoker and passed in
034         * the Request instance to the container.
035         */
036        public static final String POJO_INSTANCE = WebServiceContainer.class.getName()+"@pojoInstance";
037    
038        /**
039         * Used when this WebServiceContainer is servicing a POJO implementing the
040         * ServiceLifecycle interface, in which case the WebServiceContainer is expected
041         * to put the JAX-RPC MessageContext it creates in the Request instance.
042         */
043        public static final String MESSAGE_CONTEXT = WebServiceContainer.class.getName()+"@MessageContext";
044    
045        /**
046         * Used for JAX-WS MessageContext. MessageContext must expose HttpServletRequest. 
047         */
048        public static final String SERVLET_REQUEST = 
049            WebServiceContainer.class.getName()+"@ServletRequest";
050        
051        /**
052         * Used for JAX-WS MessageContext. MessageContext must expose HttpServletResponse.
053         */
054        public static final String SERVLET_RESPONSE = 
055            WebServiceContainer.class.getName()+"@ServletResponse";
056        
057        /**
058         * Used for JAX-WS MessageContext. MessageContext must expose ServletContext.
059         */
060        public static final String SERVLET_CONTEXT = 
061            WebServiceContainer.class.getName()+"@ServletContext";
062        
063        /**
064         * Token inserted into wsdl where location should be replaced with the real location
065         */
066        public String LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
067    
068        void invoke(Request request, Response response) throws Exception;
069    
070        void getWsdl(Request req, Response res) throws Exception;
071    
072        void destroy();
073    
074        public interface Request {
075            /** the HTTP OPTIONS type */
076            int OPTIONS = 0; // Section 9.2
077            /** the HTTP GET type */
078            int GET     = 1; // Section 9.3
079            /** the HTTP HEAD type */
080            int HEAD    = 2; // Section 9.4
081            /** the HTTP POST type */
082            int POST    = 3; // Section 9.5
083            /** the HTTP PUT type */
084            int PUT     = 4; // Section 9.6
085            /** the HTTP DELETE type */
086            int DELETE  = 5; // Section 9.7
087            /** the HTTP TRACE type */
088            int TRACE   = 6; // Section 9.8
089            /** the HTTP CONNECT type */
090            int CONNECT = 7; // Section 9.9
091            /** the HTTP UNSUPPORTED type */
092            int UNSUPPORTED = 8;
093            /** the Accept header */
094            String HEADER_ACCEPT = "Accept";
095            /** the Accept-Encoding header */
096            String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
097            /** the Accept-Language header */
098            String HEADER_ACCEPT_LANGUAGE = "Accept-Language";
099            /** the Content-Type header */
100            String HEADER_CONTENT_TYPE = "Content-Type";
101            /** the Content-Length header */
102            String HEADER_CONTENT_LENGTH = "Content-Length";
103            /** the Connection header */
104            String HEADER_CONNECTION = "Connection";
105            /** the Cache-Control header */
106            String HEADER_CACHE_CONTROL = "Cache-Control";
107            /** the Host header */
108            String HEADER_HOST = "Host";
109            /** the User-Agent header */
110            String HEADER_USER_AGENT = "User-Agent";
111            /** the Set-Cookie header */
112            String HEADER_SET_COOKIE = "Set-Cookie";
113            /** the Cookie header */
114            String HEADER_COOKIE = "Cookie";
115    
116            String getHeader(String name);
117    
118            URI getURI();
119    
120            int getContentLength();
121    
122            String getContentType();
123    
124            InputStream getInputStream() throws IOException;
125    
126            int getMethod();
127    
128            String getParameter(String name);
129    
130            Map getParameters();
131    
132            Object getAttribute(String name);
133    
134            void setAttribute(String name, Object value);
135    
136            java.lang.String getRemoteAddr();
137    
138            java.lang.String getContextPath();
139        }
140    
141        public interface Response {
142            void setHeader(String name, String value);
143    
144            String getHeader(String name);
145    
146            OutputStream getOutputStream();
147    
148            void setStatusCode(int code);
149    
150            int getStatusCode();
151    
152            void setContentType(String type);
153    
154            String getContentType();
155    
156            void setStatusMessage(String responseString);
157            
158            void flushBuffer() throws java.io.IOException;
159        }
160    
161    }