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