KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > webservices > WebServiceContainer


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.webservices;
18
19 import java.io.IOException JavaDoc;
20 import java.io.InputStream JavaDoc;
21 import java.io.OutputStream JavaDoc;
22 import java.io.Serializable JavaDoc;
23 import java.net.URI JavaDoc;
24 import java.util.Map JavaDoc;
25
26 /**
27  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
28  */

29 public interface WebServiceContainer extends Serializable JavaDoc {
30
31     /**
32      * Used when this WebServiceContainer is servicing a POJO, in which case
33      * the pojo instance is held by the enclosing servlet/invoker and passed in
34      * the Request instance to the container.
35      */

36     public static final String JavaDoc POJO_INSTANCE = WebServiceContainer.class.getName()+"@pojoInstance";
37
38     /**
39      * Used when this WebServiceContainer is servicing a POJO implementing the
40      * ServiceLifecycle interface, in which case the WebServiceContainer is expected
41      * to put the JAX-RPC MessageContext it creates in the Request instance.
42      */

43     public static final String JavaDoc MESSAGE_CONTEXT = WebServiceContainer.class.getName()+"@MessageContext";
44
45     /**
46      * Token inserted into wsdl where location should be replaced with the real location
47      */

48     public String JavaDoc LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
49
50     void invoke(Request request, Response response) throws Exception JavaDoc;
51
52     void getWsdl(Request req, Response res) throws Exception JavaDoc;
53
54     public interface Request {
55         /** the HTTP OPTIONS type */
56         int OPTIONS = 0; // Section 9.2
57
/** the HTTP GET type */
58         int GET = 1; // Section 9.3
59
/** the HTTP HEAD type */
60         int HEAD = 2; // Section 9.4
61
/** the HTTP POST type */
62         int POST = 3; // Section 9.5
63
/** the HTTP PUT type */
64         int PUT = 4; // Section 9.6
65
/** the HTTP DELETE type */
66         int DELETE = 5; // Section 9.7
67
/** the HTTP TRACE type */
68         int TRACE = 6; // Section 9.8
69
/** the HTTP CONNECT type */
70         int CONNECT = 7; // Section 9.9
71
/** the HTTP UNSUPPORTED type */
72         int UNSUPPORTED = 8;
73         /** the Accept header */
74         String JavaDoc HEADER_ACCEPT = "Accept";
75         /** the Accept-Encoding header */
76         String JavaDoc HEADER_ACCEPT_ENCODING = "Accept-Encoding";
77         /** the Accept-Language header */
78         String JavaDoc HEADER_ACCEPT_LANGUAGE = "Accept-Language";
79         /** the Content-Type header */
80         String JavaDoc HEADER_CONTENT_TYPE = "Content-Type";
81         /** the Content-Length header */
82         String JavaDoc HEADER_CONTENT_LENGTH = "Content-Length";
83         /** the Connection header */
84         String JavaDoc HEADER_CONNECTION = "Connection";
85         /** the Cache-Control header */
86         String JavaDoc HEADER_CACHE_CONTROL = "Cache-Control";
87         /** the Host header */
88         String JavaDoc HEADER_HOST = "Host";
89         /** the User-Agent header */
90         String JavaDoc HEADER_USER_AGENT = "User-Agent";
91         /** the Set-Cookie header */
92         String JavaDoc HEADER_SET_COOKIE = "Set-Cookie";
93         /** the Cookie header */
94         String JavaDoc HEADER_COOKIE = "Cookie";
95
96         String JavaDoc getHeader(String JavaDoc name);
97
98         URI JavaDoc getURI();
99
100         int getContentLength();
101
102         String JavaDoc getContentType();
103
104         InputStream JavaDoc getInputStream() throws IOException JavaDoc;
105
106         int getMethod();
107
108         String JavaDoc getParameter(String JavaDoc name);
109
110         Map JavaDoc getParameters();
111
112         Object JavaDoc getAttribute(String JavaDoc name);
113
114         void setAttribute(String JavaDoc name, Object JavaDoc value);
115     }
116
117     public interface Response {
118         void setHeader(String JavaDoc name, String JavaDoc value);
119
120         String JavaDoc getHeader(String JavaDoc name);
121
122         OutputStream JavaDoc getOutputStream();
123
124         void setStatusCode(int code);
125
126         int getStatusCode();
127
128         void setContentType(String JavaDoc type);
129
130         String JavaDoc getContentType();
131
132         void setStatusMessage(String JavaDoc responseString);
133     }
134
135 }
136
Popular Tags