1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.geronimo.webservices;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.io.OutputStream;
23 import java.io.Serializable;
24 import java.net.URI;
25 import java.util.Map;
26
27 /**
28 * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $
29 */
30 public interface WebServiceContainer extends Serializable {
31
32 /**
33 * Used when this WebServiceContainer is servicing a POJO, in which case
34 * the pojo instance is held by the enclosing servlet/invoker and passed in
35 * the Request instance to the container.
36 */
37 public static final String POJO_INSTANCE = WebServiceContainer.class.getName()+"@pojoInstance";
38
39 /**
40 * Used when this WebServiceContainer is servicing a POJO implementing the
41 * ServiceLifecycle interface, in which case the WebServiceContainer is expected
42 * to put the JAX-RPC MessageContext it creates in the Request instance.
43 */
44 public static final String MESSAGE_CONTEXT = WebServiceContainer.class.getName()+"@MessageContext";
45
46 /**
47 * Token inserted into wsdl where location should be replaced with the real location
48 */
49 public String LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
50
51 void invoke(Request request, Response response) throws Exception;
52
53 void getWsdl(Request req, Response res) throws Exception;
54
55 public interface Request {
56 /** the HTTP OPTIONS type */
57 int OPTIONS = 0;
58 /** the HTTP GET type */
59 int GET = 1;
60 /** the HTTP HEAD type */
61 int HEAD = 2;
62 /** the HTTP POST type */
63 int POST = 3;
64 /** the HTTP PUT type */
65 int PUT = 4;
66 /** the HTTP DELETE type */
67 int DELETE = 5;
68 /** the HTTP TRACE type */
69 int TRACE = 6;
70 /** the HTTP CONNECT type */
71 int CONNECT = 7;
72 /** the HTTP UNSUPPORTED type */
73 int UNSUPPORTED = 8;
74 /** the Accept header */
75 String HEADER_ACCEPT = "Accept";
76 /** the Accept-Encoding header */
77 String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
78 /** the Accept-Language header */
79 String HEADER_ACCEPT_LANGUAGE = "Accept-Language";
80 /** the Content-Type header */
81 String HEADER_CONTENT_TYPE = "Content-Type";
82 /** the Content-Length header */
83 String HEADER_CONTENT_LENGTH = "Content-Length";
84 /** the Connection header */
85 String HEADER_CONNECTION = "Connection";
86 /** the Cache-Control header */
87 String HEADER_CACHE_CONTROL = "Cache-Control";
88 /** the Host header */
89 String HEADER_HOST = "Host";
90 /** the User-Agent header */
91 String HEADER_USER_AGENT = "User-Agent";
92 /** the Set-Cookie header */
93 String HEADER_SET_COOKIE = "Set-Cookie";
94 /** the Cookie header */
95 String HEADER_COOKIE = "Cookie";
96
97 String getHeader(String name);
98
99 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 }