KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Connector


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina;
30
31 import org.apache.catalina.net.ServerSocketFactory;
32
33 // START OF SJSAS 8.1 PE 6191830
34
import java.security.cert.X509Certificate JavaDoc;
35 // END OF SJSAS 8.1 PE 6191830
36
// START S1AS 6188932
37
import com.sun.appserv.ProxyHandler;
38 // END S1AS 6188932
39
// START SJSAS 6363251
40
import org.apache.coyote.Adapter;
41 // END SJSAS 6363251
42

43 /**
44  * A <b>Connector</b> is a component responsible receiving requests from,
45  * and returning responses to, a client application. A Connector performs
46  * the following general logic:
47  * <ul>
48  * <li>Receive a request from the client application.
49  * <li>Create (or allocate from a pool) appropriate Request and Response
50  * instances, and populate their properties based on the contents of
51  * the received request, as described below.
52  * <ul>
53  * <li>For all Requests, the <code>connector</code>,
54  * <code>protocol</code>, <code>remoteAddr</code>,
55  * <code>response</code>, <code>scheme</code>,
56  * <code>secure</code>, <code>serverName</code>,
57  * <code>serverPort</code> and <code>stream</code>
58  * properties <b>MUST</b> be set. The <code>contentLength</code>
59  * and <code>contentType</code> properties are also generally set.
60  * <li>For HttpRequests, the <code>method</code>, <code>queryString</code>,
61  * <code>requestedSessionCookie</code>,
62  * <code>requestedSessionId</code>, <code>requestedSessionURL</code>,
63  * <code>requestURI</code>, and <code>secure</code> properties
64  * <b>MUST</b> be set. In addition, the various <code>addXxx</code>
65  * methods must be called to record the presence of cookies, headers,
66  * and locales in the original request.
67  * <li>For all Responses, the <code>connector</code>, <code>request</code>,
68  * and <code>stream</code> properties <b>MUST</b> be set.
69  * <li>No additional headers must be set by the Connector for
70  * HttpResponses.
71  * </ul>
72  * <li>Identify an appropriate Container to use for processing this request.
73  * For a stand alone Catalina installation, this will probably be a
74  * (singleton) Engine implementation. For a Connector attaching Catalina
75  * to a web server such as Apache, this step could take advantage of
76  * parsing already performed within the web server to identify the
77  * Context, and perhaps even the Wrapper, to utilize in satisfying this
78  * Request.
79  * <li>Call the <code>invoke()</code> method of the selected Container,
80  * passing the initialized Request and Response instances as arguments.
81  * <li>Return any response created by the Container to the client, or
82  * return an appropriate error message if an exception of any type
83  * was thrown.
84  * <li>If utilizing a pool of Request and Response objects, recycle the pair
85  * of instances that was just used.
86  * </ul>
87  * It is expected that the implementation details of various Connectors will
88  * vary widely, so the logic above should considered typical rather than
89  * normative.
90  *
91  * @author Craig R. McClanahan
92  * @version $Revision: 1.5 $ $Date: 2006/01/18 22:15:20 $
93  */

94
95 public interface Connector {
96
97
98     // ------------------------------------------------------------- Properties
99

100
101     /**
102      * Return the Container used for processing requests received by this
103      * Connector.
104      */

105     public Container getContainer();
106
107
108     /**
109      * Set the Container used for processing requests received by this
110      * Connector.
111      *
112      * @param container The new Container to use
113      */

114     public void setContainer(Container container);
115
116
117     /**
118      * Return the "enable DNS lookups" flag.
119      */

120     public boolean getEnableLookups();
121
122
123     /**
124      * Set the "enable DNS lookups" flag.
125      *
126      * @param enableLookups The new "enable DNS lookups" flag value
127      */

128     public void setEnableLookups(boolean enableLookups);
129
130
131     /**
132      * Return the server socket factory used by this Container.
133      */

134     public ServerSocketFactory getFactory();
135
136
137     /**
138      * Set the server socket factory used by this Container.
139      *
140      * @param factory The new server socket factory
141      */

142     public void setFactory(ServerSocketFactory factory);
143
144
145     /**
146      * Return descriptive information about this Connector implementation.
147      */

148     public String JavaDoc getInfo();
149
150
151     /**
152      * Return the port number to which a request should be redirected if
153      * it comes in on a non-SSL port and is subject to a security constraint
154      * with a transport guarantee that requires SSL.
155      */

156     public int getRedirectPort();
157
158
159     /**
160      * Set the redirect port number.
161      *
162      * @param redirectPort The redirect port number (non-SSL to SSL)
163      */

164     public void setRedirectPort(int redirectPort);
165
166
167     /**
168      * Return the scheme that will be assigned to requests received
169      * through this connector. Default value is "http".
170      */

171     public String JavaDoc getScheme();
172
173
174     /**
175      * Set the scheme that will be assigned to requests received through
176      * this connector.
177      *
178      * @param scheme The new scheme
179      */

180     public void setScheme(String JavaDoc scheme);
181
182
183     /**
184      * Return the secure connection flag that will be assigned to requests
185      * received through this connector. Default value is "false".
186      */

187     public boolean getSecure();
188
189
190     /**
191      * Set the secure connection flag that will be assigned to requests
192      * received through this connector.
193      *
194      * @param secure The new secure connection flag
195      */

196     public void setSecure(boolean secure);
197
198
199     /**
200      * Return the <code>Service</code> with which we are associated (if any).
201      */

202     public Service getService();
203
204
205     /**
206      * Set the <code>Service</code> with which we are associated (if any).
207      *
208      * @param service The service that owns this Engine
209      */

210     public void setService(Service service);
211
212
213     // BEGIN S1AS 5000999
214
/**
215      * Sets the default host for this Connector.
216      *
217      * @param defaultHost The default host for this Connector
218      */

219     public void setDefaultHost(String JavaDoc defaultHost);
220
221     /**
222      * Gets the default host of this Connector.
223      *
224      * @return The default host of this Connector
225      */

226     public String JavaDoc getDefaultHost();
227     // END S1AS 5000999
228

229
230     // START S1AS 6188932
231
/**
232      * Returns the value of this connector's authPassthroughEnabled flag.
233      *
234      * @return true if this connector is receiving its requests from
235      * a trusted intermediate server, false otherwise
236      */

237     public boolean getAuthPassthroughEnabled();
238
239     /**
240      * Sets the value of this connector's authPassthroughEnabled flag.
241      *
242      * @param authPassthroughEnabled true if this connector is receiving its
243      * requests from a trusted intermediate server, false otherwise
244      */

245     public void setAuthPassthroughEnabled(boolean authPassthroughEnabled);
246
247     /**
248      * Gets the ProxyHandler instance associated with this CoyoteConnector.
249      *
250      * @return ProxyHandler instance associated with this CoyoteConnector,
251      * or null
252      */

253     public ProxyHandler getProxyHandler();
254
255     /**
256      * Sets the ProxyHandler implementation for this CoyoteConnector to use.
257      *
258      * @param proxyHandler ProxyHandler instance to use
259      */

260     public void setProxyHandler(ProxyHandler proxyHandler);
261     // END S1AS 6188932
262

263
264     // --------------------------------------------------------- Public Methods
265

266
267     /**
268      * Create (or allocate) and return a Request object suitable for
269      * specifying the contents of a Request to the responsible Container.
270      */

271     public Request createRequest();
272
273
274     /**
275      * Create (or allocate) and return a Response object suitable for
276      * receiving the contents of a Response from the responsible Container.
277      */

278     public Response createResponse();
279
280     /**
281      * Invoke a pre-startup initialization. This is used to allow connectors
282      * to bind to restricted ports under Unix operating environments.
283      *
284      * @exception LifecycleException If this server was already initialized.
285      */

286     public void initialize()
287     throws LifecycleException;
288
289     // START OF SJSAS 8.1 PE 6191830
290
/**
291       * Get the underlying WebContainer certificate for the request
292       */

293     public X509Certificate JavaDoc[] getCertificates(Request request);
294     // END OF SJSAS 8.1 PE 6191830
295

296     // START CR 6309511
297
/**
298      * Get the encoding to be used for byte<-->char conversion for
299      * data sent/received via this Connector
300      */

301     public String JavaDoc getURIEncoding();
302
303     /**
304      * Set the encoding to be used for byte<-->char conversion for
305      * data sent/received via this Connector
306      */

307     public void setURIEncoding(String JavaDoc encoding);
308     // END CR 6309511
309

310     
311     // START SJSAS 6363251
312
/**
313      * Set the <code>Adapter</code> used by this connector.
314      */

315     public void setAdapter(Adapter adapter);
316     
317     
318     /**
319      * Get the <code>Adapter</code> used by this connector.
320      */

321     public Adapter getAdapter();
322     // END SJSAS 6363251
323
}
324
Popular Tags