1 | | /* | | 1 | | /* | | 1 | | /* |
2 | | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.24.2.2 2002/01/3 1 23:13:5 3 craigmcc Exp $ | | 2 | | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.34 2002/0 3/18 07:1 5:39 remm Exp $ | | 2 | | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.34 2002/03/18 07:15:39 remm Exp $ |
3 | | * $Revision: 1.24.2.2 $ | | 3 | | * $Revision: 1.34 $ | | 3 | | * $Revision: 1.34 $ |
4 | | * $Date: 2002/01/3 1 23:13:5 3 $ | | 4 | | * $Date: 2002/0 3/18 07:1 5:39 $ | | 4 | | * $Date: 2002/03/18 07:15:39 $ |
5 | | * | | 5 | | * | | 5 | | * |
6 | | * ==================================================================== | | 6 | | * ==================================================================== | | 6 | | * ==================================================================== |
7 | | * | | 7 | | * | | 7 | | * |
8 | | * The Apache Software License, Version 1.1 | | 8 | | * The Apache Software License, Version 1.1 | | 8 | | * The Apache Software License, Version 1.1 |
9 | | * | | 9 | | * | | 9 | | * |
10 | | * Copyright (c) 1999 The Apache Software Foundation. All rights | | 10 | | * Copyright (c) 1999 The Apache Software Foundation. All rights | | 10 | | * Copyright (c) 1999 The Apache Software Foundation. All rights |
11 | | * reserved. | | 11 | | * reserved. | | 11 | | * reserved. |
12 | | * | | 12 | | * | | 12 | | * |
13 | | * Redistribution and use in source and binary forms, with or without | | 13 | | * Redistribution and use in source and binary forms, with or without | | 13 | | * Redistribution and use in source and binary forms, with or without |
14 | | * modification, are permitted provided that the following conditions | | 14 | | * modification, are permitted provided that the following conditions | | 14 | | * modification, are permitted provided that the following conditions |
15 | | * are met: | | 15 | | * are met: | | 15 | | * are met: |
16 | | * | | 16 | | * | | 16 | | * |
17 | | * 1. Redistributions of source code must retain the above copyright | | 17 | | * 1. Redistributions of source code must retain the above copyright | | 17 | | * 1. Redistributions of source code must retain the above copyright |
18 | | * notice, this list of conditions and the following disclaimer. | | 18 | | * notice, this list of conditions and the following disclaimer. | | 18 | | * notice, this list of conditions and the following disclaimer. |
19 | | * | | 19 | | * | | 19 | | * |
20 | | * 2. Redistributions in binary form must reproduce the above copyright | | 20 | | * 2. Redistributions in binary form must reproduce the above copyright | | 20 | | * 2. Redistributions in binary form must reproduce the above copyright |
21 | | * notice, this list of conditions and the following disclaimer in | | 21 | | * notice, this list of conditions and the following disclaimer in | | 21 | | * notice, this list of conditions and the following disclaimer in |
22 | | * the documentation and/or other materials provided with the | | 22 | | * the documentation and/or other materials provided with the | | 22 | | * the documentation and/or other materials provided with the |
23 | | * distribution. | | 23 | | * distribution. | | 23 | | * distribution. |
24 | | * | | 24 | | * | | 24 | | * |
25 | | * 3. The end-user documentation included with the redistribution, if | | 25 | | * 3. The end-user documentation included with the redistribution, if | | 25 | | * 3. The end-user documentation included with the redistribution, if |
26 | | * any, must include the following acknowlegement: | | 26 | | * any, must include the following acknowlegement: | | 26 | | * any, must include the following acknowlegement: |
27 | | * "This product includes software developed by the | | 27 | | * "This product includes software developed by the | | 27 | | * "This product includes software developed by the |
28 | | * Apache Software Foundation (http://www.apache.org/)." | | 28 | | * Apache Software Foundation (http://www.apache.org/)." | | 28 | | * Apache Software Foundation (http://www.apache.org/)." |
29 | | * Alternately, this acknowlegement may appear in the software itself, | | 29 | | * Alternately, this acknowlegement may appear in the software itself, | | 29 | | * Alternately, this acknowlegement may appear in the software itself, |
30 | | * if and wherever such third-party acknowlegements normally appear. | | 30 | | * if and wherever such third-party acknowlegements normally appear. | | 30 | | * if and wherever such third-party acknowlegements normally appear. |
31 | | * | | 31 | | * | | 31 | | * |
32 | | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | | 32 | | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | | 32 | | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software |
33 | | * Foundation" must not be used to endorse or promote products derived | | 33 | | * Foundation" must not be used to endorse or promote products derived | | 33 | | * Foundation" must not be used to endorse or promote products derived |
34 | | * from this software without prior written permission. For written | | 34 | | * from this software without prior written permission. For written | | 34 | | * from this software without prior written permission. For written |
35 | | * permission, please contact apache@apache.org. | | 35 | | * permission, please contact apache@apache.org. | | 35 | | * permission, please contact apache@apache.org. |
36 | | * | | 36 | | * | | 36 | | * |
37 | | * 5. Products derived from this software may not be called "Apache" | | 37 | | * 5. Products derived from this software may not be called "Apache" | | 37 | | * 5. Products derived from this software may not be called "Apache" |
38 | | * nor may "Apache" appear in their names without prior written | | 38 | | * nor may "Apache" appear in their names without prior written | | 38 | | * nor may "Apache" appear in their names without prior written |
39 | | * permission of the Apache Group. | | 39 | | * permission of the Apache Group. | | 39 | | * permission of the Apache Group. |
40 | | * | | 40 | | * | | 40 | | * |
41 | | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | | 41 | | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | | 41 | | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
42 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 42 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 42 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
43 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 43 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 43 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
44 | | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | | 44 | | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | | 44 | | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR |
45 | | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 45 | | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 45 | | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
46 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | | 46 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | | 46 | | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
47 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | | 47 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | | 47 | | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
48 | | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | | 48 | | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | | 48 | | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
49 | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 49 | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 49 | | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
50 | | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | | 50 | | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | | 50 | | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
51 | | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 51 | | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 51 | | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
52 | | * SUCH DAMAGE. | | 52 | | * SUCH DAMAGE. | | 52 | | * SUCH DAMAGE. |
53 | | * ==================================================================== | | 53 | | * ==================================================================== | | 53 | | * ==================================================================== |
54 | | * | | 54 | | * | | 54 | | * |
55 | | * This software consists of voluntary contributions made by many | | 55 | | * This software consists of voluntary contributions made by many | | 55 | | * This software consists of voluntary contributions made by many |
56 | | * individuals on behalf of the Apache Software Foundation. For more | | 56 | | * individuals on behalf of the Apache Software Foundation. For more | | 56 | | * individuals on behalf of the Apache Software Foundation. For more |
57 | | * information on the Apache Software Foundation, please see | | 57 | | * information on the Apache Software Foundation, please see | | 57 | | * information on the Apache Software Foundation, please see |
58 | | * <http://www.apache.org/>. | | 58 | | * <http://www.apache.org/>. | | 58 | | * <http://www.apache.org/>. |
59 | | * | | 59 | | * | | 59 | | * |
60 | | * [Additional notices, if required by prior licensing conditions] | | 60 | | * [Additional notices, if required by prior licensing conditions] | | 60 | | * [Additional notices, if required by prior licensing conditions] |
61 | | * | | 61 | | * | | 61 | | * |
62 | | */ | | 62 | | */ | | 62 | | */ |
63 | | | | 63 | | | | 63 | | |
64 | | | | 64 | | | | 64 | | |
65 | | package org.apache.catalina.connector.http; | | 65 | | package org.apache.catalina.connector.http; | | 65 | | package org.apache.catalina.connector.http; |
66 | | | | 66 | | | | 66 | | |
67 | | | | 67 | | | | 67 | | |
68 | | import java.io.IOException; | | 68 | | import java.io.IOException; | | 68 | | import java.io.IOException; |
69 | | import java.net.BindException; | | 69 | | import java.net.BindException; | | 69 | | import java.net.BindException; |
70 | | import java.net.InetAddress; | | 70 | | import java.net.InetAddress; | | 70 | | import java.net.InetAddress; |
71 | | import java.net.ServerSocket; | | 71 | | import java.net.ServerSocket; | | 71 | | import java.net.ServerSocket; |
72 | | import java.net.Socket; | | 72 | | import java.net.Socket; | | 72 | | import java.net.Socket; |
| | | | 73 | | import java.net.UnknownHostException; | | 73 | | import java.net.UnknownHostException; |
73 | | import java.security.AccessControlException; | | 74 | | import java.security.AccessControlException; | | 74 | | import java.security.AccessControlException; |
74 | | import java.util.Stack; | | 75 | | import java.util.Stack; | | 75 | | import java.util.Stack; |
75 | | import java.util.Vector; | | 76 | | import java.util.Vector; | | 76 | | import java.util.Vector; |
76 | | import java.util.Enumeration; | | 77 | | import java.util.Enumeration; | | 77 | | import java.util.Enumeration; |
| | | | 78 | | import java.security.KeyStoreException; | | 78 | | import java.security.KeyStoreException; |
| | | | 79 | | import java.security.NoSuchAlgorithmException; | | 79 | | import java.security.NoSuchAlgorithmException; |
| | | | 80 | | import java.security.cert.CertificateException; | | 80 | | import java.security.cert.CertificateException; |
| | | | 81 | | import java.security.UnrecoverableKeyException; | | 81 | | import java.security.UnrecoverableKeyException; |
| | | | 82 | | import java.security.KeyManagementException; | | 82 | | import java.security.KeyManagementException; |
77 | | import org.apache.catalina.Connector; | | 83 | | import org.apache.catalina.Connector; | | 83 | | import org.apache.catalina.Connector; |
78 | | import org.apache.catalina.Container; | | 84 | | import org.apache.catalina.Container; | | 84 | | import org.apache.catalina.Container; |
79 | | import org.apache.catalina.HttpRequest; | | 85 | | import org.apache.catalina.HttpRequest; | | 85 | | import org.apache.catalina.HttpRequest; |
80 | | import org.apache.catalina.HttpResponse; | | 86 | | import org.apache.catalina.HttpResponse; | | 86 | | import org.apache.catalina.HttpResponse; |
81 | | import org.apache.catalina.Lifecycle; | | 87 | | import org.apache.catalina.Lifecycle; | | 87 | | import org.apache.catalina.Lifecycle; |
82 | | import org.apache.catalina.LifecycleEvent; | | 88 | | import org.apache.catalina.LifecycleEvent; | | 88 | | import org.apache.catalina.LifecycleEvent; |
83 | | import org.apache.catalina.LifecycleException; | | 89 | | import org.apache.catalina.LifecycleException; | | 89 | | import org.apache.catalina.LifecycleException; |
84 | | import org.apache.catalina.LifecycleListener; | | 90 | | import org.apache.catalina.LifecycleListener; | | 90 | | import org.apache.catalina.LifecycleListener; |
85 | | import org.apache.catalina.Logger; | | 91 | | import org.apache.catalina.Logger; | | 91 | | import org.apache.catalina.Logger; |
86 | | import org.apache.catalina.Request; | | 92 | | import org.apache.catalina.Request; | | 92 | | import org.apache.catalina.Request; |
87 | | import org.apache.catalina.Response; | | 93 | | import org.apache.catalina.Response; | | 93 | | import org.apache.catalina.Response; |
88 | | import org.apache.catalina.Service; | | 94 | | import org.apache.catalina.Service; | | 94 | | import org.apache.catalina.Service; |
89 | | import org.apache.catalina.net.DefaultServerSocketFactory; | | 95 | | import org.apache.catalina.net.DefaultServerSocketFactory; | | 95 | | import org.apache.catalina.net.DefaultServerSocketFactory; |
90 | | import org.apache.catalina.net.ServerSocketFactory; | | 96 | | import org.apache.catalina.net.ServerSocketFactory; | | 96 | | import org.apache.catalina.net.ServerSocketFactory; |
91 | | import org.apache.catalina.util.LifecycleSupport; | | 97 | | import org.apache.catalina.util.LifecycleSupport; | | 97 | | import org.apache.catalina.util.LifecycleSupport; |
92 | | import org.apache.catalina.util.StringManager; | | 98 | | import org.apache.catalina.util.StringManager; | | 98 | | import org.apache.catalina.util.StringManager; |
93 | | | | 99 | | | | 99 | | |
94 | | | | 100 | | | | 100 | | |
95 | | /** | | 101 | | /** | | 101 | | /** |
96 | | * Implementation of an HTTP/1.1 connector. | | 102 | | * Implementation of an HTTP/1.1 connector. | | 102 | | * Implementation of an HTTP/1.1 connector. |
97 | | * | | 103 | | * | | 103 | | * |
98 | | * @author Craig R. McClanahan | | 104 | | * @author Craig R. McClanahan | | 104 | | * @author Craig R. McClanahan |
99 | | * @author Remy Maucherat | | 105 | | * @author Remy Maucherat | | 105 | | * @author Remy Maucherat |
100 | | * @version $Revision: 1.24.2.2 $ $Date: 2002/01/3 1 23:13:5 3 $ | | 106 | | * @version $Revision: 1.34 $ $Date: 2002/0 3/18 07:1 5:39 $ | | 106 | | * @version $Revision: 1.34 $ $Date: 2002/03/18 07:15:39 $ |
| | | | 107 | | * @deprecated | | 107 | | * @deprecated |
101 | | */ | | 108 | | */ | | 108 | | */ |
102 | | | | 109 | | | | 109 | | |
103 | | | | 110 | | | | 110 | | |
104 | | public final class HttpConnector | | 111 | | public final class HttpConnector | | 111 | | public final class HttpConnector |
105 | | implements Connector, Lifecycle, Runnable { | | 112 | | implements Connector, Lifecycle, Runnable { | | 112 | | implements Connector, Lifecycle, Runnable { |
106 | | | | 113 | | | | 113 | | |
107 | | | | 114 | | | | 114 | | |
108 | | // ----------------------------------------------------- Instance Variables | | 115 | | // ----------------------------------------------------- Instance Variables | | 115 | | // ----------------------------------------------------- Instance Variables |
109 | | | | 116 | | | | 116 | | |
110 | | | | 117 | | | | 117 | | |
111 | | /** | | 118 | | /** | | 118 | | /** |
112 | | * The <code>Service</code> we are associated with (if any). | | 119 | | * The <code>Service</code> we are associated with (if any). | | 119 | | * The <code>Service</code> we are associated with (if any). |
113 | | */ | | 120 | | */ | | 120 | | */ |
114 | | private Service service = null; | | 121 | | private Service service = null; | | 121 | | private Service service = null; |
115 | | | | 122 | | | | 122 | | |
116 | | | | 123 | | | | 123 | | |
117 | | /** | | 124 | | /** | | 124 | | /** |
118 | | * The accept count for this Connector. | | 125 | | * The accept count for this Connector. | | 125 | | * The accept count for this Connector. |
119 | | */ | | 126 | | */ | | 126 | | */ |
120 | | private int acceptCount = 10; | | 127 | | private int acceptCount = 10; | | 127 | | private int acceptCount = 10; |
121 | | | | 128 | | | | 128 | | |
122 | | | | 129 | | | | 129 | | |
123 | | /** | | 130 | | /** | | 130 | | /** |
124 | | * The IP address on which to bind, if any. If <code>null</code>, all | | 131 | | * The IP address on which to bind, if any. If <code>null</code>, all | | 131 | | * The IP address on which to bind, if any. If <code>null</code>, all |
125 | | * addresses on the server will be bound. | | 132 | | * addresses on the server will be bound. | | 132 | | * addresses on the server will be bound. |
126 | | */ | | 133 | | */ | | 133 | | */ |
127 | | private String address = null; | | 134 | | private String address = null; | | 134 | | private String address = null; |
128 | | | | 135 | | | | 135 | | |
129 | | | | 136 | | | | 136 | | |
130 | | /** | | 137 | | /** | | 137 | | /** |
131 | | * The input buffer size we should create on input streams. | | 138 | | * The input buffer size we should create on input streams. | | 138 | | * The input buffer size we should create on input streams. |
132 | | */ | | 139 | | */ | | 139 | | */ |
133 | | private int bufferSize = 2048; | | 140 | | private int bufferSize = 2048; | | 140 | | private int bufferSize = 2048; |
134 | | | | 141 | | | | 141 | | |
135 | | | | 142 | | | | 142 | | |
136 | | /** | | 143 | | /** | | 143 | | /** |
137 | | * The Container used for processing requests received by this Connector. | | 144 | | * The Container used for processing requests received by this Connector. | | 144 | | * The Container used for processing requests received by this Connector. |
138 | | */ | | 145 | | */ | | 145 | | */ |
139 | | protected Container container = null; | | 146 | | protected Container container = null; | | 146 | | protected Container container = null; |
140 | | | | 147 | | | | 147 | | |
141 | | | | 148 | | | | 148 | | |
142 | | /** | | 149 | | /** | | 149 | | /** |
143 | | * The set of processors that have ever been created. | | 150 | | * The set of processors that have ever been created. | | 150 | | * The set of processors that have ever been created. |
144 | | */ | | 151 | | */ | | 151 | | */ |
145 | | private Vector created = new Vector(); | | 152 | | private Vector created = new Vector(); | | 152 | | private Vector created = new Vector(); |
146 | | | | 153 | | | | 153 | | |
147 | | | | 154 | | | | 154 | | |
148 | | /** | | 155 | | /** | | 155 | | /** |
149 | | * The current number of processors that have been created. | | 156 | | * The current number of processors that have been created. | | 156 | | * The current number of processors that have been created. |
150 | | */ | | 157 | | */ | | 157 | | */ |
151 | | private int curProcessors = 0; | | 158 | | private int curProcessors = 0; | | 158 | | private int curProcessors = 0; |
152 | | | | 159 | | | | 159 | | |
153 | | | | 160 | | | | 160 | | |
154 | | /** | | 161 | | /** | | 161 | | /** |
155 | | * The debugging detail level for this component. | | 162 | | * The debugging detail level for this component. | | 162 | | * The debugging detail level for this component. |
156 | | */ | | 163 | | */ | | 163 | | */ |
157 | | private int debug = 0; | | 164 | | private int debug = 0; | | 164 | | private int debug = 0; |
158 | | | | 165 | | | | 165 | | |
159 | | | | 166 | | | | 166 | | |
160 | | /** | | 167 | | /** | | 167 | | /** |
161 | | * The "enable DNS lookups" flag for this Connector. | | 168 | | * The "enable DNS lookups" flag for this Connector. | | 168 | | * The "enable DNS lookups" flag for this Connector. |
162 | | */ | | 169 | | */ | | 169 | | */ |
163 | | private boolean enableLookups = false; | | 170 | | private boolean enableLookups = false; | | 170 | | private boolean enableLookups = false; |
164 | | | | 171 | | | | 171 | | |
165 | | | | 172 | | | | 172 | | |
166 | | /** | | 173 | | /** | | 173 | | /** |
167 | | * The server socket factory for this component. | | 174 | | * The server socket factory for this component. | | 174 | | * The server socket factory for this component. |
168 | | */ | | 175 | | */ | | 175 | | */ |
169 | | private ServerSocketFactory factory = null; | | 176 | | private ServerSocketFactory factory = null; | | 176 | | private ServerSocketFactory factory = null; |
170 | | | | 177 | | | | 177 | | |
171 | | | | 178 | | | | 178 | | |
172 | | /** | | 179 | | /** | | 179 | | /** |
173 | | * Descriptive information about this Connector implementation. | | 180 | | * Descriptive information about this Connector implementation. | | 180 | | * Descriptive information about this Connector implementation. |
174 | | */ | | 181 | | */ | | 181 | | */ |
175 | | private static final String info = | | 182 | | private static final String info = | | 182 | | private static final String info = |
176 | | "org.apache.catalina.connector.http.HttpConnector/1.0"; | | 183 | | "org.apache.catalina.connector.http.HttpConnector/1.0"; | | 183 | | "org.apache.catalina.connector.http.HttpConnector/1.0"; |
177 | | | | 184 | | | | 184 | | |
178 | | | | 185 | | | | 185 | | |
179 | | /** | | 186 | | /** | | 186 | | /** |
180 | | * The lifecycle event support for this component. | | 187 | | * The lifecycle event support for this component. | | 187 | | * The lifecycle event support for this component. |
181 | | */ | | 188 | | */ | | 188 | | */ |
182 | | protected LifecycleSupport lifecycle = new LifecycleSupport(this); | | 189 | | protected LifecycleSupport lifecycle = new LifecycleSupport(this); | | 189 | | protected LifecycleSupport lifecycle = new LifecycleSupport(this); |
183 | | | | 190 | | | | 190 | | |
184 | | | | 191 | | | | 191 | | |
185 | | /** | | 192 | | /** | | 192 | | /** |
186 | | * The minimum number of processors to start at initialization time. | | 193 | | * The minimum number of processors to start at initialization time. | | 193 | | * The minimum number of processors to start at initialization time. |
187 | | */ | | 194 | | */ | | 194 | | */ |
188 | | protected int minProcessors = 5; | | 195 | | protected int minProcessors = 5; | | 195 | | protected int minProcessors = 5; |
189 | | | | 196 | | | | 196 | | |
190 | | | | 197 | | | | 197 | | |
191 | | /** | | 198 | | /** | | 198 | | /** |
192 | | * The maximum number of processors allowed, or <0 for unlimited. | | 199 | | * The maximum number of processors allowed, or <0 for unlimited. | | 199 | | * The maximum number of processors allowed, or <0 for unlimited. |
193 | | */ | | 200 | | */ | | 200 | | */ |
194 | | private int maxProcessors = 20; | | 201 | | private int maxProcessors = 20; | | 201 | | private int maxProcessors = 20; |
195 | | | | 202 | | | | 202 | | |
196 | | | | 203 | | | | 203 | | |
197 | | /** | | 204 | | /** | | 204 | | /** |
198 | | * Timeout value on the incoming connection. | | 205 | | * Timeout value on the incoming connection. | | 205 | | * Timeout value on the incoming connection. |
199 | | * Note : a value of 0 means no timeout. | | 206 | | * Note : a value of 0 means no timeout. | | 206 | | * Note : a value of 0 means no timeout. |
200 | | */ | | 207 | | */ | | 207 | | */ |
201 | | private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT; | | 208 | | private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT; | | 208 | | private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT; |
202 | | | | 209 | | | | 209 | | |
203 | | | | 210 | | | | 210 | | |
204 | | /** | | 211 | | /** | | 211 | | /** |
205 | | * The port number on which we listen for HTTP requests. | | 212 | | * The port number on which we listen for HTTP requests. | | 212 | | * The port number on which we listen for HTTP requests. |
206 | | */ | | 213 | | */ | | 213 | | */ |
207 | | private int port = 8080; | | 214 | | private int port = 8080; | | 214 | | private int port = 8080; |
208 | | | | 215 | | | | 215 | | |
209 | | | | 216 | | | | 216 | | |
210 | | /** | | 217 | | /** | | 217 | | /** |
211 | | * The set of processors that have been created but are not currently | | 218 | | * The set of processors that have been created but are not currently | | 218 | | * The set of processors that have been created but are not currently |
212 | | * being used to process a request. | | 219 | | * being used to process a request. | | 219 | | * being used to process a request. |
213 | | */ | | 220 | | */ | | 220 | | */ |
214 | | private Stack processors = new Stack(); | | 221 | | private Stack processors = new Stack(); | | 221 | | private Stack processors = new Stack(); |
215 | | | | 222 | | | | 222 | | |
216 | | | | 223 | | | | 223 | | |
217 | | /** | | 224 | | /** | | 224 | | /** |
218 | | * The server name to which we should pretend requests to this Connector | | 225 | | * The server name to which we should pretend requests to this Connector | | 225 | | * The server name to which we should pretend requests to this Connector |
219 | | * were directed. This is useful when operating Tomcat behind a proxy | | 226 | | * were directed. This is useful when operating Tomcat behind a proxy | | 226 | | * were directed. This is useful when operating Tomcat behind a proxy |
220 | | * server, so that redirects get constructed accurately. If not specified, | | 227 | | * server, so that redirects get constructed accurately. If not specified, | | 227 | | * server, so that redirects get constructed accurately. If not specified, |
221 | | * the server name included in the <code>Host</code> header is used. | | 228 | | * the server name included in the <code>Host</code> header is used. | | 228 | | * the server name included in the <code>Host</code> header is used. |
222 | | */ | | 229 | | */ | | 229 | | */ |
223 | | private String proxyName = null; | | 230 | | private String proxyName = null; | | 230 | | private String proxyName = null; |
224 | | | | 231 | | | | 231 | | |
225 | | | | 232 | | | | 232 | | |
226 | | /** | | 233 | | /** | | 233 | | /** |
227 | | * The server port to which we should pretent requests to this Connector | | 234 | | * The server port to which we should pretent requests to this Connector | | 234 | | * The server port to which we should pretent requests to this Connector |
228 | | * were directed. This is useful when operating Tomcat behind a proxy | | 235 | | * were directed. This is useful when operating Tomcat behind a proxy | | 235 | | * were directed. This is useful when operating Tomcat behind a proxy |
229 | | * server, so that redirects get constructed accurately. If not specified, | | 236 | | * server, so that redirects get constructed accurately. If not specified, | | 236 | | * server, so that redirects get constructed accurately. If not specified, |
230 | | * the port number specified by the <code>port</code> property is used. | | 237 | | * the port number specified by the <code>port</code> property is used. | | 237 | | * the port number specified by the <code>port</code> property is used. |
231 | | */ | | 238 | | */ | | 238 | | */ |
232 | | private int proxyPort = 0; | | 239 | | private int proxyPort = 0; | | 239 | | private int proxyPort = 0; |
233 | | | | 240 | | | | 240 | | |
234 | | | | 241 | | | | 241 | | |
235 | | /** | | 242 | | /** | | 242 | | /** |
236 | | * The redirect port for non-SSL to SSL redirects. | | 243 | | * The redirect port for non-SSL to SSL redirects. | | 243 | | * The redirect port for non-SSL to SSL redirects. |
237 | | */ | | 244 | | */ | | 244 | | */ |
238 | | private int redirectPort = 443; | | 245 | | private int redirectPort = 443; | | 245 | | private int redirectPort = 443; |
239 | | | | 246 | | | | 246 | | |
240 | | | | 247 | | | | 247 | | |
241 | | /** | | 248 | | /** | | 248 | | /** |
242 | | * The request scheme that will be set on all requests received | | 249 | | * The request scheme that will be set on all requests received | | 249 | | * The request scheme that will be set on all requests received |
243 | | * through this connector. | | 250 | | * through this connector. | | 250 | | * through this connector. |
244 | | */ | | 251 | | */ | | 251 | | */ |
245 | | private String scheme = "http"; | | 252 | | private String scheme = "http"; | | 252 | | private String scheme = "http"; |
246 | | | | 253 | | | | 253 | | |
247 | | | | 254 | | | | 254 | | |
248 | | /** | | 255 | | /** | | 255 | | /** |
249 | | * The secure connection flag that will be set on all requests received | | 256 | | * The secure connection flag that will be set on all requests received | | 256 | | * The secure connection flag that will be set on all requests received |
250 | | * through this connector. | | 257 | | * through this connector. | | 257 | | * through this connector. |
251 | | */ | | 258 | | */ | | 258 | | */ |
252 | | private boolean secure = false; | | 259 | | private boolean secure = false; | | 259 | | private boolean secure = false; |
253 | | | | 260 | | | | 260 | | |
254 | | | | 261 | | | | 261 | | |
255 | | /** | | 262 | | /** | | 262 | | /** |
256 | | * The server socket through which we listen for incoming TCP connections. | | 263 | | * The server socket through which we listen for incoming TCP connections. | | 263 | | * The server socket through which we listen for incoming TCP connections. |
257 | | */ | | 264 | | */ | | 264 | | */ |
258 | | private ServerSocket serverSocket = null; | | 265 | | private ServerSocket serverSocket = null; | | 265 | | private ServerSocket serverSocket = null; |
259 | | | | 266 | | | | 266 | | |
260 | | | | 267 | | | | 267 | | |
261 | | /** | | 268 | | /** | | 268 | | /** |
262 | | * The string manager for this package. | | 269 | | * The string manager for this package. | | 269 | | * The string manager for this package. |
263 | | */ | | 270 | | */ | | 270 | | */ |
264 | | private StringManager sm = | | 271 | | private StringManager sm = | | 271 | | private StringManager sm = |
265 | | StringManager.getManager(Constants.Package); | | 272 | | StringManager.getManager(Constants.Package); | | 272 | | StringManager.getManager(Constants.Package); |
266 | | | | 273 | | | | 273 | | |
267 | | | | 274 | | | | 274 | | |
268 | | /** | | 275 | | /** | | 275 | | /** |
269 | | * Has this component been initialized yet? | | 276 | | * Has this component been initialized yet? | | 276 | | * Has this component been initialized yet? |
270 | | */ | | 277 | | */ | | 277 | | */ |
271 | | private boolean initialized = false; | | 278 | | private boolean initialized = false; | | 278 | | private boolean initialized = false; |
272 | | | | 279 | | | | 279 | | |
273 | | | | 280 | | | | 280 | | |
274 | | /** | | 281 | | /** | | 281 | | /** |
275 | | * Has this component been started yet? | | 282 | | * Has this component been started yet? | | 282 | | * Has this component been started yet? |
276 | | */ | | 283 | | */ | | 283 | | */ |
277 | | private boolean started = false; | | 284 | | private boolean started = false; | | 284 | | private boolean started = false; |
278 | | | | 285 | | | | 285 | | |
279 | | | | 286 | | | | 286 | | |
280 | | /** | | 287 | | /** | | 287 | | /** |
281 | | * The shutdown signal to our background thread | | 288 | | * The shutdown signal to our background thread | | 288 | | * The shutdown signal to our background thread |
282 | | */ | | 289 | | */ | | 289 | | */ |
283 | | private boolean stopped = false; | | 290 | | private boolean stopped = false; | | 290 | | private boolean stopped = false; |
284 | | | | 291 | | | | 291 | | |
285 | | | | 292 | | | | 292 | | |
286 | | /** | | 293 | | /** | | 293 | | /** |
287 | | * The background thread. | | 294 | | * The background thread. | | 294 | | * The background thread. |
288 | | */ | | 295 | | */ | | 295 | | */ |
289 | | private Thread thread = null; | | 296 | | private Thread thread = null; | | 296 | | private Thread thread = null; |
290 | | | | 297 | | | | 297 | | |
291 | | | | 298 | | | | 298 | | |
292 | | /** | | 299 | | /** | | 299 | | /** |
293 | | * The name to register for the background thread. | | 300 | | * The name to register for the background thread. | | 300 | | * The name to register for the background thread. |
294 | | */ | | 301 | | */ | | 301 | | */ |
295 | | private String threadName = null; | | 302 | | private String threadName = null; | | 302 | | private String threadName = null; |
296 | | | | 303 | | | | 303 | | |
297 | | | | 304 | | | | 304 | | |
298 | | /** | | 305 | | /** | | 305 | | /** |
299 | | * The thread synchronization object. | | 306 | | * The thread synchronization object. | | 306 | | * The thread synchronization object. |
300 | | */ | | 307 | | */ | | 307 | | */ |
301 | | private Object threadSync = new Object(); | | 308 | | private Object threadSync = new Object(); | | 308 | | private Object threadSync = new Object(); |
302 | | | | 309 | | | | 309 | | |
303 | | | | 310 | | | | 310 | | |
304 | | /** | | 311 | | /** | | 311 | | /** |
305 | | * Is chunking allowed ? | | 312 | | * Is chunking allowed ? | | 312 | | * Is chunking allowed ? |
306 | | */ | | 313 | | */ | | 313 | | */ |
307 | | private boolean allowChunking = true; | | 314 | | private boolean allowChunking = true; | | 314 | | private boolean allowChunking = true; |
308 | | | | 315 | | | | 315 | | |
309 | | | | 316 | | | | 316 | | |
310 | | /** | | 317 | | /** | | 317 | | /** |
311 | | * Use TCP no delay ? | | 318 | | * Use TCP no delay ? | | 318 | | * Use TCP no delay ? |
312 | | */ | | 319 | | */ | | 319 | | */ |
313 | | private boolean tcpNoDelay = true; | | 320 | | private boolean tcpNoDelay = true; | | 320 | | private boolean tcpNoDelay = true; |
314 | | | | 321 | | | | 321 | | |
315 | | | | 322 | | | | 322 | | |
316 | | // ------------------------------------------------------------- Properties | | 323 | | // ------------------------------------------------------------- Properties | | 323 | | // ------------------------------------------------------------- Properties |
317 | | | | 324 | | | | 324 | | |
318 | | | | 325 | | | | 325 | | |
319 | | /** | | 326 | | /** | | 326 | | /** |
320 | | * Return the <code>Service</code> with which we are associated (if any). | | 327 | | * Return the <code>Service</code> with which we are associated (if any). | | 327 | | * Return the <code>Service</code> with which we are associated (if any). |
321 | | */ | | 328 | | */ | | 328 | | */ |
322 | | public Service getService() { | | 329 | | public Service getService() { | | 329 | | public Service getService() { |
323 | | | | 330 | | | | 330 | | |
324 | | return (this.service); | | 331 | | return (this.service); | | 331 | | return (this.service); |
325 | | | | 332 | | | | 332 | | |
326 | | } | | 333 | | } | | 333 | | } |
327 | | | | 334 | | | | 334 | | |
328 | | | | 335 | | | | 335 | | |
329 | | /** | | 336 | | /** | | 336 | | /** |
330 | | * Set the <code>Service</code> with which we are associated (if any). | | 337 | | * Set the <code>Service</code> with which we are associated (if any). | | 337 | | * Set the <code>Service</code> with which we are associated (if any). |
331 | | * | | 338 | | * | | 338 | | * |
332 | | * @param service The service that owns this Engine | | 339 | | * @param service The service that owns this Engine | | 339 | | * @param service The service that owns this Engine |
333 | | */ | | 340 | | */ | | 340 | | */ |
334 | | public void setService(Service service) { | | 341 | | public void setService(Service service) { | | 341 | | public void setService(Service service) { |
335 | | | | 342 | | | | 342 | | |
336 | | this.service = service; | | 343 | | this.service = service; | | 343 | | this.service = service; |
337 | | | | 344 | | | | 344 | | |
338 | | } | | 345 | | } | | 345 | | } |
339 | | | | 346 | | | | 346 | | |
340 | | | | 347 | | | | 347 | | |
341 | | /** | | 348 | | /** | | 348 | | /** |
342 | | * Return the connection timeout for this Connector. | | 349 | | * Return the connection timeout for this Connector. | | 349 | | * Return the connection timeout for this Connector. |
343 | | */ | | 350 | | */ | | 350 | | */ |
344 | | public int getConnectionTimeout() { | | 351 | | public int getConnectionTimeout() { | | 351 | | public int getConnectionTimeout() { |
345 | | | | 352 | | | | 352 | | |
346 | | return (connectionTimeout); | | 353 | | return (connectionTimeout); | | 353 | | return (connectionTimeout); |
347 | | | | 354 | | | | 354 | | |
348 | | } | | 355 | | } | | 355 | | } |
349 | | | | 356 | | | | 356 | | |
350 | | | | 357 | | | | 357 | | |
351 | | /** | | 358 | | /** | | 358 | | /** |
352 | | * Set the connection timeout for this Connector. | | 359 | | * Set the connection timeout for this Connector. | | 359 | | * Set the connection timeout for this Connector. |
353 | | * | | 360 | | * | | 360 | | * |
354 | | * @param count The new connection timeout | | 361 | | * @param count The new connection timeout | | 361 | | * @param count The new connection timeout |
355 | | */ | | 362 | | */ | | 362 | | */ |
356 | | public void setConnectionTimeout(int connectionTimeout) { | | 363 | | public void setConnectionTimeout(int connectionTimeout) { | | 363 | | public void setConnectionTimeout(int connectionTimeout) { |
357 | | | | 364 | | | | 364 | | |
358 | | this.connectionTimeout = connectionTimeout; | | 365 | | this.connectionTimeout = connectionTimeout; | | 365 | | this.connectionTimeout = connectionTimeout; |
359 | | | | 366 | | | | 366 | | |
360 | | } | | 367 | | } | | 367 | | } |
361 | | | | 368 | | | | 368 | | |
362 | | | | 369 | | | | 369 | | |
363 | | /** | | 370 | | /** | | 370 | | /** |
364 | | * Return the accept count for this Connector. | | 371 | | * Return the accept count for this Connector. | | 371 | | * Return the accept count for this Connector. |
365 | | */ | | 372 | | */ | | 372 | | */ |
366 | | public int getAcceptCount() { | | 373 | | public int getAcceptCount() { | | 373 | | public int getAcceptCount() { |
367 | | | | 374 | | | | 374 | | |
368 | | return (acceptCount); | | 375 | | return (acceptCount); | | 375 | | return (acceptCount); |
369 | | | | 376 | | | | 376 | | |
370 | | } | | 377 | | } | | 377 | | } |
371 | | | | 378 | | | | 378 | | |
372 | | | | 379 | | | | 379 | | |
373 | | /** | | 380 | | /** | | 380 | | /** |
374 | | * Set the accept count for this Connector. | | 381 | | * Set the accept count for this Connector. | | 381 | | * Set the accept count for this Connector. |
375 | | * | | 382 | | * | | 382 | | * |
376 | | * @param count The new accept count | | 383 | | * @param count The new accept count | | 383 | | * @param count The new accept count |
377 | | */ | | 384 | | */ | | 384 | | */ |
378 | | public void setAcceptCount(int count) { | | 385 | | public void setAcceptCount(int count) { | | 385 | | public void setAcceptCount(int count) { |
379 | | | | 386 | | | | 386 | | |
380 | | this.acceptCount = count; | | 387 | | this.acceptCount = count; | | 387 | | this.acceptCount = count; |
381 | | | | 388 | | | | 388 | | |
382 | | } | | 389 | | } | | 389 | | } |
383 | | | | 390 | | | | 390 | | |
384 | | | | 391 | | | | 391 | | |
385 | | /** | | 392 | | /** | | 392 | | /** |
386 | | * Get the allow chunking flag. | | 393 | | * Get the allow chunking flag. | | 393 | | * Get the allow chunking flag. |
387 | | */ | | 394 | | */ | | 394 | | */ |
388 | | public boolean isChunkingAllowed() { | | 395 | | public boolean isChunkingAllowed() { | | 395 | | public boolean isChunkingAllowed() { |
389 | | | | 396 | | | | 396 | | |
390 | | return (allowChunking); | | 397 | | return (allowChunking); | | 397 | | return (allowChunking); |
391 | | | | 398 | | | | 398 | | |
392 | | } | | 399 | | } | | 399 | | } |
393 | | | | 400 | | | | 400 | | |
394 | | | | 401 | | | | 401 | | |
395 | | /** | | 402 | | /** | | 402 | | /** |
| | | | 403 | | * Get the allow chunking flag. | | 403 | | * Get the allow chunking flag. |
| | | | 404 | | */ | | 404 | | */ |
| | | | 405 | | public boolean getAllowChunking() { | | 405 | | public boolean getAllowChunking() { |
| | | | 406 | | | | 406 | | |
| | | | 407 | | return isChunkingAllowed(); | | 407 | | return isChunkingAllowed(); |
| | | | 408 | | | | 408 | | |
| | | | 409 | | } | | 409 | | } |
| | | | 410 | | | | 410 | | |
| | | | 411 | | | | 411 | | |
| | | | 412 | | /** | | 412 | | /** |
396 | | * Set the allow chunking flag. | | 413 | | * Set the allow chunking flag. | | 413 | | * Set the allow chunking flag. |
397 | | * | | 414 | | * | | 414 | | * |
398 | | * @param allowChunking Allow chunking flag | | 415 | | * @param allowChunking Allow chunking flag | | 415 | | * @param allowChunking Allow chunking flag |
399 | | */ | | 416 | | */ | | 416 | | */ |
400 | | public void setAllowChunking(boolean allowChunking) { | | 417 | | public void setAllowChunking(boolean allowChunking) { | | 417 | | public void setAllowChunking(boolean allowChunking) { |
401 | | | | 418 | | | | 418 | | |
402 | | this.allowChunking = allowChunking; | | 419 | | this.allowChunking = allowChunking; | | 419 | | this.allowChunking = allowChunking; |
403 | | | | 420 | | | | 420 | | |
404 | | } | | 421 | | } | | 421 | | } |
405 | | | | 422 | | | | 422 | | |
406 | | | | 423 | | | | 423 | | |
407 | | /** | | 424 | | /** | | 424 | | /** |
408 | | * Return the bind IP address for this Connector. | | 425 | | * Return the bind IP address for this Connector. | | 425 | | * Return the bind IP address for this Connector. |
409 | | */ | | 426 | | */ | | 426 | | */ |
410 | | public String getAddress() { | | 427 | | public String getAddress() { | | 427 | | public String getAddress() { |
411 | | | | 428 | | | | 428 | | |
412 | | return (this.address); | | 429 | | return (this.address); | | 429 | | return (this.address); |
413 | | | | 430 | | | | 430 | | |
414 | | } | | 431 | | } | | 431 | | } |
415 | | | | 432 | | | | 432 | | |
416 | | | | 433 | | | | 433 | | |
417 | | /** | | 434 | | /** | | 434 | | /** |
418 | | * Set the bind IP address for this Connector. | | 435 | | * Set the bind IP address for this Connector. | | 435 | | * Set the bind IP address for this Connector. |
419 | | * | | 436 | | * | | 436 | | * |
420 | | * @param address The bind IP address | | 437 | | * @param address The bind IP address | | 437 | | * @param address The bind IP address |
421 | | */ | | 438 | | */ | | 438 | | */ |
422 | | public void setAddress(String address) { | | 439 | | public void setAddress(String address) { | | 439 | | public void setAddress(String address) { |
423 | | | | 440 | | | | 440 | | |
424 | | this.address = address; | | 441 | | this.address = address; | | 441 | | this.address = address; |
425 | | | | 442 | | | | 442 | | |
426 | | } | | 443 | | } | | 443 | | } |
427 | | | | 444 | | | | 444 | | |
428 | | | | 445 | | | | 445 | | |
429 | | /** | | 446 | | /** | | 446 | | /** |
430 | | * Is this connector available for processing requests? | | 447 | | * Is this connector available for processing requests? | | 447 | | * Is this connector available for processing requests? |
431 | | */ | | 448 | | */ | | 448 | | */ |
432 | | public boolean isAvailable() { | | 449 | | public boolean isAvailable() { | | 449 | | public boolean isAvailable() { |
433 | | | | 450 | | | | 450 | | |
434 | | return (started); | | 451 | | return (started); | | 451 | | return (started); |
435 | | | | 452 | | | | 452 | | |
436 | | } | | 453 | | } | | 453 | | } |
437 | | | | 454 | | | | 454 | | |
438 | | | | 455 | | | | 455 | | |
439 | | /** | | 456 | | /** | | 456 | | /** |
440 | | * Return the input buffer size for this Connector. | | 457 | | * Return the input buffer size for this Connector. | | 457 | | * Return the input buffer size for this Connector. |
441 | | */ | | 458 | | */ | | 458 | | */ |
442 | | public int getBufferSize() { | | 459 | | public int getBufferSize() { | | 459 | | public int getBufferSize() { |
443 | | | | 460 | | | | 460 | | |
444 | | return (this.bufferSize); | | 461 | | return (this.bufferSize); | | 461 | | return (this.bufferSize); |
445 | | | | 462 | | | | 462 | | |
446 | | } | | 463 | | } | | 463 | | } |
447 | | | | 464 | | | | 464 | | |
448 | | | | 465 | | | | 465 | | |
449 | | /** | | 466 | | /** | | 466 | | /** |
450 | | * Set the input buffer size for this Connector. | | 467 | | * Set the input buffer size for this Connector. | | 467 | | * Set the input buffer size for this Connector. |
451 | | * | | 468 | | * | | 468 | | * |
452 | | * @param bufferSize The new input buffer size. | | 469 | | * @param bufferSize The new input buffer size. | | 469 | | * @param bufferSize The new input buffer size. |
453 | | */ | | 470 | | */ | | 470 | | */ |
454 | | public void setBufferSize(int bufferSize) { | | 471 | | public void setBufferSize(int bufferSize) { | | 471 | | public void setBufferSize(int bufferSize) { |
455 | | | | 472 | | | | 472 | | |
456 | | this.bufferSize = bufferSize; | | 473 | | this.bufferSize = bufferSize; | | 473 | | this.bufferSize = bufferSize; |
457 | | | | 474 | | | | 474 | | |
458 | | } | | 475 | | } | | 475 | | } |
459 | | | | 476 | | | | 476 | | |
460 | | | | 477 | | | | 477 | | |
461 | | /** | | 478 | | /** | | 478 | | /** |
462 | | * Return the Container used for processing requests received by this | | 479 | | * Return the Container used for processing requests received by this | | 479 | | * Return the Container used for processing requests received by this |
463 | | * Connector. | | 480 | | * Connector. | | 480 | | * Connector. |
464 | | */ | | 481 | | */ | | 481 | | */ |
465 | | public Container getContainer() { | | 482 | | public Container getContainer() { | | 482 | | public Container getContainer() { |
466 | | | | 483 | | | | 483 | | |
467 | | return (container); | | 484 | | return (container); | | 484 | | return (container); |
468 | | | | 485 | | | | 485 | | |
469 | | } | | 486 | | } | | 486 | | } |
470 | | | | 487 | | | | 487 | | |
471 | | | | 488 | | | | 488 | | |
472 | | /** | | 489 | | /** | | 489 | | /** |
473 | | * Set the Container used for processing requests received by this | | 490 | | * Set the Container used for processing requests received by this | | 490 | | * Set the Container used for processing requests received by this |
474 | | * Connector. | | 491 | | * Connector. | | 491 | | * Connector. |
475 | | * | | 492 | | * | | 492 | | * |
476 | | * @param container The new Container to use | | 493 | | * @param container The new Container to use | | 493 | | * @param container The new Container to use |
477 | | */ | | 494 | | */ | | 494 | | */ |
478 | | public void setContainer(Container container) { | | 495 | | public void setContainer(Container container) { | | 495 | | public void setContainer(Container container) { |
479 | | | | 496 | | | | 496 | | |
480 | | this.container = container; | | 497 | | this.container = container; | | 497 | | this.container = container; |
481 | | | | 498 | | | | 498 | | |
482 | | } | | 499 | | } | | 499 | | } |
483 | | | | 500 | | | | 500 | | |
484 | | | | 501 | | | | 501 | | |
485 | | /** | | 502 | | /** | | 502 | | /** |
486 | | * Return the current number of processors that have been created. | | 503 | | * Return the current number of processors that have been created. | | 503 | | * Return the current number of processors that have been created. |
487 | | */ | | 504 | | */ | | 504 | | */ |
488 | | public int getCurProcessors() { | | 505 | | public int getCurProcessors() { | | 505 | | public int getCurProcessors() { |
489 | | | | 506 | | | | 506 | | |
490 | | return (curProcessors); | | 507 | | return (curProcessors); | | 507 | | return (curProcessors); |
491 | | | | 508 | | | | 508 | | |
492 | | } | | 509 | | } | | 509 | | } |
493 | | | | 510 | | | | 510 | | |
494 | | | | 511 | | | | 511 | | |
495 | | /** | | 512 | | /** | | 512 | | /** |
496 | | * Return the debugging detail level for this component. | | 513 | | * Return the debugging detail level for this component. | | 513 | | * Return the debugging detail level for this component. |
497 | | */ | | 514 | | */ | | 514 | | */ |
498 | | public int getDebug() { | | 515 | | public int getDebug() { | | 515 | | public int getDebug() { |
499 | | | | 516 | | | | 516 | | |
500 | | return (debug); | | 517 | | return (debug); | | 517 | | return (debug); |
501 | | | | 518 | | | | 518 | | |
502 | | } | | 519 | | } | | 519 | | } |
503 | | | | 520 | | | | 520 | | |
504 | | | | 521 | | | | 521 | | |
505 | | /** | | 522 | | /** | | 522 | | /** |
506 | | * Set the debugging detail level for this component. | | 523 | | * Set the debugging detail level for this component. | | 523 | | * Set the debugging detail level for this component. |
507 | | * | | 524 | | * | | 524 | | * |
508 | | * @param debug The new debugging detail level | | 525 | | * @param debug The new debugging detail level | | 525 | | * @param debug The new debugging detail level |
509 | | */ | | 526 | | */ | | 526 | | */ |
510 | | public void setDebug(int debug) { | | 527 | | public void setDebug(int debug) { | | 527 | | public void setDebug(int debug) { |
511 | | | | 528 | | | | 528 | | |
512 | | this.debug = debug; | | 529 | | this.debug = debug; | | 529 | | this.debug = debug; |
513 | | | | 530 | | | | 530 | | |
514 | | } | | 531 | | } | | 531 | | } |
515 | | | | 532 | | | | 532 | | |
516 | | | | 533 | | | | 533 | | |
517 | | /** | | 534 | | /** | | 534 | | /** |
518 | | * Return the "enable DNS lookups" flag. | | 535 | | * Return the "enable DNS lookups" flag. | | 535 | | * Return the "enable DNS lookups" flag. |
519 | | */ | | 536 | | */ | | 536 | | */ |
520 | | public boolean getEnableLookups() { | | 537 | | public boolean getEnableLookups() { | | 537 | | public boolean getEnableLookups() { |
521 | | | | 538 | | | | 538 | | |
522 | | return (this.enableLookups); | | 539 | | return (this.enableLookups); | | 539 | | return (this.enableLookups); |
523 | | | | 540 | | | | 540 | | |
524 | | } | | 541 | | } | | 541 | | } |
525 | | | | 542 | | | | 542 | | |
526 | | | | 543 | | | | 543 | | |
527 | | /** | | 544 | | /** | | 544 | | /** |
528 | | * Set the "enable DNS lookups" flag. | | 545 | | * Set the "enable DNS lookups" flag. | | 545 | | * Set the "enable DNS lookups" flag. |
529 | | * | | 546 | | * | | 546 | | * |
530 | | * @param enableLookups The new "enable DNS lookups" flag value | | 547 | | * @param enableLookups The new "enable DNS lookups" flag value | | 547 | | * @param enableLookups The new "enable DNS lookups" flag value |
531 | | */ | | 548 | | */ | | 548 | | */ |
532 | | public void setEnableLookups(boolean enableLookups) { | | 549 | | public void setEnableLookups(boolean enableLookups) { | | 549 | | public void setEnableLookups(boolean enableLookups) { |
533 | | | | 550 | | | | 550 | | |
534 | | this.enableLookups = enableLookups; | | 551 | | this.enableLookups = enableLookups; | | 551 | | this.enableLookups = enableLookups; |
535 | | | | 552 | | | | 552 | | |
536 | | } | | 553 | | } | | 553 | | } |
537 | | | | 554 | | | | 554 | | |
538 | | | | 555 | | | | 555 | | |
539 | | /** | | 556 | | /** | | 556 | | /** |
540 | | * Return the server socket factory used by this Container. | | 557 | | * Return the server socket factory used by this Container. | | 557 | | * Return the server socket factory used by this Container. |
541 | | */ | | 558 | | */ | | 558 | | */ |
542 | | public ServerSocketFactory getFactory() { | | 559 | | public ServerSocketFactory getFactory() { | | 559 | | public ServerSocketFactory getFactory() { |
543 | | | | 560 | | | | 560 | | |
544 | | if (this.factory == null) { | | 561 | | if (this.factory == null) { | | 561 | | if (this.factory == null) { |
545 | | synchronized (this) { | | 562 | | synchronized (this) { | | 562 | | synchronized (this) { |
546 | | this.factory = new DefaultServerSocketFactory(); | | 563 | | this.factory = new DefaultServerSocketFactory(); | | 563 | | this.factory = new DefaultServerSocketFactory(); |
547 | | } | | 564 | | } | | 564 | | } |
548 | | } | | 565 | | } | | 565 | | } |
549 | | return (this.factory); | | 566 | | return (this.factory); | | 566 | | return (this.factory); |
550 | | | | 567 | | | | 567 | | |
551 | | } | | 568 | | } | | 568 | | } |
552 | | | | 569 | | | | 569 | | |
553 | | | | 570 | | | | 570 | | |
554 | | /** | | 571 | | /** | | 571 | | /** |
555 | | * Set the server socket factory used by this Container. | | 572 | | * Set the server socket factory used by this Container. | | 572 | | * Set the server socket factory used by this Container. |
556 | | * | | 573 | | * | | 573 | | * |
557 | | * @param factory The new server socket factory | | 574 | | * @param factory The new server socket factory | | 574 | | * @param factory The new server socket factory |
558 | | */ | | 575 | | */ | | 575 | | */ |
559 | | public void setFactory(ServerSocketFactory factory) { | | 576 | | public void setFactory(ServerSocketFactory factory) { | | 576 | | public void setFactory(ServerSocketFactory factory) { |
560 | | | | 577 | | | | 577 | | |
561 | | this.factory = factory; | | 578 | | this.factory = factory; | | 578 | | this.factory = factory; |
562 | | | | 579 | | | | 579 | | |
563 | | } | | 580 | | } | | 580 | | } |
564 | | | | 581 | | | | 581 | | |
565 | | | | 582 | | | | 582 | | |
566 | | /** | | 583 | | /** | | 583 | | /** |
567 | | * Return descriptive information about this Connector implementation. | | 584 | | * Return descriptive information about this Connector implementation. | | 584 | | * Return descriptive information about this Connector implementation. |
568 | | */ | | 585 | | */ | | 585 | | */ |
569 | | public String getInfo() { | | 586 | | public String getInfo() { | | 586 | | public String getInfo() { |
570 | | | | 587 | | | | 587 | | |
571 | | return (info); | | 588 | | return (info); | | 588 | | return (info); |
572 | | | | 589 | | | | 589 | | |
573 | | } | | 590 | | } | | 590 | | } |
574 | | | | 591 | | | | 591 | | |
575 | | | | 592 | | | | 592 | | |
576 | | /** | | 593 | | /** | | 593 | | /** |
577 | | * Return the minimum number of processors to start at initialization. | | 594 | | * Return the minimum number of processors to start at initialization. | | 594 | | * Return the minimum number of processors to start at initialization. |
578 | | */ | | 595 | | */ | | 595 | | */ |
579 | | public int getMinProcessors() { | | 596 | | public int getMinProcessors() { | | 596 | | public int getMinProcessors() { |
580 | | | | 597 | | | | 597 | | |
581 | | return (minProcessors); | | 598 | | return (minProcessors); | | 598 | | return (minProcessors); |
582 | | | | 599 | | | | 599 | | |
583 | | } | | 600 | | } | | 600 | | } |
584 | | | | 601 | | | | 601 | | |
585 | | | | 602 | | | | 602 | | |
586 | | /** | | 603 | | /** | | 603 | | /** |
587 | | * Set the minimum number of processors to start at initialization. | | 604 | | * Set the minimum number of processors to start at initialization. | | 604 | | * Set the minimum number of processors to start at initialization. |
588 | | * | | 605 | | * | | 605 | | * |
589 | | * @param minProcessors The new minimum processors | | 606 | | * @param minProcessors The new minimum processors | | 606 | | * @param minProcessors The new minimum processors |
590 | | */ | | 607 | | */ | | 607 | | */ |
591 | | public void setMinProcessors(int minProcessors) { | | 608 | | public void setMinProcessors(int minProcessors) { | | 608 | | public void setMinProcessors(int minProcessors) { |
592 | | | | 609 | | | | 609 | | |
593 | | this.minProcessors = minProcessors; | | 610 | | this.minProcessors = minProcessors; | | 610 | | this.minProcessors = minProcessors; |
594 | | | | 611 | | | | 611 | | |
595 | | } | | 612 | | } | | 612 | | } |
596 | | | | 613 | | | | 613 | | |
597 | | | | 614 | | | | 614 | | |
598 | | /** | | 615 | | /** | | 615 | | /** |
599 | | * Return the maximum number of processors allowed, or <0 for unlimited. | | 616 | | * Return the maximum number of processors allowed, or <0 for unlimited. | | 616 | | * Return the maximum number of processors allowed, or <0 for unlimited. |
600 | | */ | | 617 | | */ | | 617 | | */ |
601 | | public int getMaxProcessors() { | | 618 | | public int getMaxProcessors() { | | 618 | | public int getMaxProcessors() { |
602 | | | | 619 | | | | 619 | | |
603 | | return (maxProcessors); | | 620 | | return (maxProcessors); | | 620 | | return (maxProcessors); |
604 | | | | 621 | | | | 621 | | |
605 | | } | | 622 | | } | | 622 | | } |
606 | | | | 623 | | | | 623 | | |
607 | | | | 624 | | | | 624 | | |
608 | | /** | | 625 | | /** | | 625 | | /** |
609 | | * Set the maximum number of processors allowed, or <0 for unlimited. | | 626 | | * Set the maximum number of processors allowed, or <0 for unlimited. | | 626 | | * Set the maximum number of processors allowed, or <0 for unlimited. |
610 | | * | | 627 | | * | | 627 | | * |
611 | | * @param maxProcessors The new maximum processors | | 628 | | * @param maxProcessors The new maximum processors | | 628 | | * @param maxProcessors The new maximum processors |
612 | | */ | | 629 | | */ | | 629 | | */ |
613 | | public void setMaxProcessors(int maxProcessors) { | | 630 | | public void setMaxProcessors(int maxProcessors) { | | 630 | | public void setMaxProcessors(int maxProcessors) { |
614 | | | | 631 | | | | 631 | | |
615 | | this.maxProcessors = maxProcessors; | | 632 | | this.maxProcessors = maxProcessors; | | 632 | | this.maxProcessors = maxProcessors; |
616 | | | | 633 | | | | 633 | | |
617 | | } | | 634 | | } | | 634 | | } |
618 | | | | 635 | | | | 635 | | |
619 | | | | 636 | | | | 636 | | |
620 | | /** | | 637 | | /** | | 637 | | /** |
621 | | * Return the port number on which we listen for HTTP requests. | | 638 | | * Return the port number on which we listen for HTTP requests. | | 638 | | * Return the port number on which we listen for HTTP requests. |
622 | | */ | | 639 | | */ | | 639 | | */ |
623 | | public int getPort() { | | 640 | | public int getPort() { | | 640 | | public int getPort() { |
624 | | | | 641 | | | | 641 | | |
625 | | return (this.port); | | 642 | | return (this.port); | | 642 | | return (this.port); |
626 | | | | 643 | | | | 643 | | |
627 | | } | | 644 | | } | | 644 | | } |
628 | | | | 645 | | | | 645 | | |
629 | | | | 646 | | | | 646 | | |
630 | | /** | | 647 | | /** | | 647 | | /** |
631 | | * Set the port number on which we listen for HTTP requests. | | 648 | | * Set the port number on which we listen for HTTP requests. | | 648 | | * Set the port number on which we listen for HTTP requests. |
632 | | * | | 649 | | * | | 649 | | * |
633 | | * @param port The new port number | | 650 | | * @param port The new port number | | 650 | | * @param port The new port number |
634 | | */ | | 651 | | */ | | 651 | | */ |
635 | | public void setPort(int port) { | | 652 | | public void setPort(int port) { | | 652 | | public void setPort(int port) { |
636 | | | | 653 | | | | 653 | | |
637 | | this.port = port; | | 654 | | this.port = port; | | 654 | | this.port = port; |
638 | | | | 655 | | | | 655 | | |
639 | | } | | 656 | | } | | 656 | | } |
640 | | | | 657 | | | | 657 | | |
641 | | | | 658 | | | | 658 | | |
642 | | /** | | 659 | | /** | | 659 | | /** |
643 | | * Return the proxy server name for this Connector. | | 660 | | * Return the proxy server name for this Connector. | | 660 | | * Return the proxy server name for this Connector. |
644 | | */ | | 661 | | */ | | 661 | | */ |
645 | | public String getProxyName() { | | 662 | | public String getProxyName() { | | 662 | | public String getProxyName() { |
646 | | | | 663 | | | | 663 | | |
647 | | return (this.proxyName); | | 664 | | return (this.proxyName); | | 664 | | return (this.proxyName); |
648 | | | | 665 | | | | 665 | | |
649 | | } | | 666 | | } | | 666 | | } |
650 | | | | 667 | | | | 667 | | |
651 | | | | 668 | | | | 668 | | |
652 | | /** | | 669 | | /** | | 669 | | /** |
653 | | * Set the proxy server name for this Connector. | | 670 | | * Set the proxy server name for this Connector. | | 670 | | * Set the proxy server name for this Connector. |
654 | | * | | 671 | | * | | 671 | | * |
655 | | * @param proxyName The new proxy server name | | 672 | | * @param proxyName The new proxy server name | | 672 | | * @param proxyName The new proxy server name |
656 | | */ | | 673 | | */ | | 673 | | */ |
657 | | public void setProxyName(String proxyName) { | | 674 | | public void setProxyName(String proxyName) { | | 674 | | public void setProxyName(String proxyName) { |
658 | | | | 675 | | | | 675 | | |
659 | | this.proxyName = proxyName; | | 676 | | this.proxyName = proxyName; | | 676 | | this.proxyName = proxyName; |
660 | | | | 677 | | | | 677 | | |
661 | | } | | 678 | | } | | 678 | | } |
662 | | | | 679 | | | | 679 | | |
663 | | | | 680 | | | | 680 | | |
664 | | /** | | 681 | | /** | | 681 | | /** |
665 | | * Return the proxy server port for this Connector. | | 682 | | * Return the proxy server port for this Connector. | | 682 | | * Return the proxy server port for this Connector. |
666 | | */ | | 683 | | */ | | 683 | | */ |
667 | | public int getProxyPort() { | | 684 | | public int getProxyPort() { | | 684 | | public int getProxyPort() { |
668 | | | | 685 | | | | 685 | | |
669 | | return (this.proxyPort); | | 686 | | return (this.proxyPort); | | 686 | | return (this.proxyPort); |
670 | | | | 687 | | | | 687 | | |
671 | | } | | 688 | | } | | 688 | | } |
672 | | | | 689 | | | | 689 | | |
673 | | | | 690 | | | | 690 | | |
674 | | /** | | 691 | | /** | | 691 | | /** |
675 | | * Set the proxy server port for this Connector. | | 692 | | * Set the proxy server port for this Connector. | | 692 | | * Set the proxy server port for this Connector. |
676 | | * | | 693 | | * | | 693 | | * |
677 | | * @param proxyPort The new proxy server port | | 694 | | * @param proxyPort The new proxy server port | | 694 | | * @param proxyPort The new proxy server port |
678 | | */ | | 695 | | */ | | 695 | | */ |
679 | | public void setProxyPort(int proxyPort) { | | 696 | | public void setProxyPort(int proxyPort) { | | 696 | | public void setProxyPort(int proxyPort) { |
680 | | | | 697 | | | | 697 | | |
681 | | this.proxyPort = proxyPort; | | 698 | | this.proxyPort = proxyPort; | | 698 | | this.proxyPort = proxyPort; |
682 | | | | 699 | | | | 699 | | |
683 | | } | | 700 | | } | | 700 | | } |
684 | | | | 701 | | | | 701 | | |
685 | | | | 702 | | | | 702 | | |
686 | | /** | | 703 | | /** | | 703 | | /** |
687 | | * Return the port number to which a request should be redirected if | | 704 | | * Return the port number to which a request should be redirected if | | 704 | | * Return the port number to which a request should be redirected if |
688 | | * it comes in on a non-SSL port and is subject to a security constraint | | 705 | | * it comes in on a non-SSL port and is subject to a security constraint | | 705 | | * it comes in on a non-SSL port and is subject to a security constraint |
689 | | * with a transport guarantee that requires SSL. | | 706 | | * with a transport guarantee that requires SSL. | | 706 | | * with a transport guarantee that requires SSL. |
690 | | */ | | 707 | | */ | | 707 | | */ |
691 | | public int getRedirectPort() { | | 708 | | public int getRedirectPort() { | | 708 | | public int getRedirectPort() { |
692 | | | | 709 | | | | 709 | | |
693 | | return (this.redirectPort); | | 710 | | return (this.redirectPort); | | 710 | | return (this.redirectPort); |
694 | | | | 711 | | | | 711 | | |
695 | | } | | 712 | | } | | 712 | | } |
696 | | | | 713 | | | | 713 | | |
697 | | | | 714 | | | | 714 | | |
698 | | /** | | 715 | | /** | | 715 | | /** |
699 | | * Set the redirect port number. | | 716 | | * Set the redirect port number. | | 716 | | * Set the redirect port number. |
700 | | * | | 717 | | * | | 717 | | * |
701 | | * @param redirectPort The redirect port number (non-SSL to SSL) | | 718 | | * @param redirectPort The redirect port number (non-SSL to SSL) | | 718 | | * @param redirectPort The redirect port number (non-SSL to SSL) |
702 | | */ | | 719 | | */ | | 719 | | */ |
703 | | public void setRedirectPort(int redirectPort) { | | 720 | | public void setRedirectPort(int redirectPort) { | | 720 | | public void setRedirectPort(int redirectPort) { |
704 | | | | 721 | | | | 721 | | |
705 | | this.redirectPort = redirectPort; | | 722 | | this.redirectPort = redirectPort; | | 722 | | this.redirectPort = redirectPort; |
706 | | | | 723 | | | | 723 | | |
707 | | } | | 724 | | } | | 724 | | } |
708 | | | | 725 | | | | 725 | | |
709 | | | | 726 | | | | 726 | | |
710 | | /** | | 727 | | /** | | 727 | | /** |
711 | | * Return the scheme that will be assigned to requests received | | 728 | | * Return the scheme that will be assigned to requests received | | 728 | | * Return the scheme that will be assigned to requests received |
712 | | * through this connector. Default value is "http". | | 729 | | * through this connector. Default value is "http". | | 729 | | * through this connector. Default value is "http". |
713 | | */ | | 730 | | */ | | 730 | | */ |
714 | | public String getScheme() { | | 731 | | public String getScheme() { | | 731 | | public String getScheme() { |
715 | | | | 732 | | | | 732 | | |
716 | | return (this.scheme); | | 733 | | return (this.scheme); | | 733 | | return (this.scheme); |
717 | | | | 734 | | | | 734 | | |
718 | | } | | 735 | | } | | 735 | | } |
719 | | | | 736 | | | | 736 | | |
720 | | | | 737 | | | | 737 | | |
721 | | /** | | 738 | | /** | | 738 | | /** |
722 | | * Set the scheme that will be assigned to requests received through | | 739 | | * Set the scheme that will be assigned to requests received through | | 739 | | * Set the scheme that will be assigned to requests received through |
723 | | * this connector. | | 740 | | * this connector. | | 740 | | * this connector. |
724 | | * | | 741 | | * | | 741 | | * |
725 | | * @param scheme The new scheme | | 742 | | * @param scheme The new scheme | | 742 | | * @param scheme The new scheme |
726 | | */ | | 743 | | */ | | 743 | | */ |
727 | | public void setScheme(String scheme) { | | 744 | | public void setScheme(String scheme) { | | 744 | | public void setScheme(String scheme) { |
728 | | | | 745 | | | | 745 | | |
729 | | this.scheme = scheme; | | 746 | | this.scheme = scheme; | | 746 | | this.scheme = scheme; |
730 | | | | 747 | | | | 747 | | |
731 | | } | | 748 | | } | | 748 | | } |
732 | | | | 749 | | | | 749 | | |
733 | | | | 750 | | | | 750 | | |
734 | | /** | | 751 | | /** | | 751 | | /** |
735 | | * Return the secure connection flag that will be assigned to requests | | 752 | | * Return the secure connection flag that will be assigned to requests | | 752 | | * Return the secure connection flag that will be assigned to requests |
736 | | * received through this connector. Default value is "false". | | 753 | | * received through this connector. Default value is "false". | | 753 | | * received through this connector. Default value is "false". |
737 | | */ | | 754 | | */ | | 754 | | */ |
738 | | public boolean getSecure() { | | 755 | | public boolean getSecure() { | | 755 | | public boolean getSecure() { |
739 | | | | 756 | | | | 756 | | |
740 | | return (this.secure); | | 757 | | return (this.secure); | | 757 | | return (this.secure); |
741 | | | | 758 | | | | 758 | | |
742 | | } | | 759 | | } | | 759 | | } |
743 | | | | 760 | | | | 760 | | |
744 | | | | 761 | | | | 761 | | |
745 | | /** | | 762 | | /** | | 762 | | /** |
746 | | * Set the secure connection flag that will be assigned to requests | | 763 | | * Set the secure connection flag that will be assigned to requests | | 763 | | * Set the secure connection flag that will be assigned to requests |
747 | | * received through this connector. | | 764 | | * received through this connector. | | 764 | | * received through this connector. |
748 | | * | | 765 | | * | | 765 | | * |
749 | | * @param secure The new secure connection flag | | 766 | | * @param secure The new secure connection flag | | 766 | | * @param secure The new secure connection flag |
750 | | */ | | 767 | | */ | | 767 | | */ |
751 | | public void setSecure(boolean secure) { | | 768 | | public void setSecure(boolean secure) { | | 768 | | public void setSecure(boolean secure) { |
752 | | | | 769 | | | | 769 | | |
753 | | this.secure = secure; | | 770 | | this.secure = secure; | | 770 | | this.secure = secure; |
754 | | | | 771 | | | | 771 | | |
755 | | } | | 772 | | } | | 772 | | } |
756 | | | | 773 | | | | 773 | | |
757 | | | | 774 | | | | 774 | | |
758 | | /** | | 775 | | /** | | 775 | | /** |
759 | | * Return the TCP no delay flag value. | | 776 | | * Return the TCP no delay flag value. | | 776 | | * Return the TCP no delay flag value. |
760 | | */ | | 777 | | */ | | 777 | | */ |
761 | | public boolean getTcpNoDelay() { | | 778 | | public boolean getTcpNoDelay() { | | 778 | | public boolean getTcpNoDelay() { |
762 | | | | 779 | | | | 779 | | |
763 | | return (this.tcpNoDelay); | | 780 | | return (this.tcpNoDelay); | | 780 | | return (this.tcpNoDelay); |
764 | | | | 781 | | | | 781 | | |
765 | | } | | 782 | | } | | 782 | | } |
766 | | | | 783 | | | | 783 | | |
767 | | | | 784 | | | | 784 | | |
768 | | /** | | 785 | | /** | | 785 | | /** |
769 | | * Set the TCP no delay flag which will be set on the socket after | | 786 | | * Set the TCP no delay flag which will be set on the socket after | | 786 | | * Set the TCP no delay flag which will be set on the socket after |
770 | | * accepting a connection. | | 787 | | * accepting a connection. | | 787 | | * accepting a connection. |
771 | | * | | 788 | | * | | 788 | | * |
772 | | * @param tcpNoDelay The new TCP no delay flag | | 789 | | * @param tcpNoDelay The new TCP no delay flag | | 789 | | * @param tcpNoDelay The new TCP no delay flag |
773 | | */ | | 790 | | */ | | 790 | | */ |
774 | | public void setTcpNoDelay(boolean tcpNoDelay) { | | 791 | | public void setTcpNoDelay(boolean tcpNoDelay) { | | 791 | | public void setTcpNoDelay(boolean tcpNoDelay) { |
775 | | | | 792 | | | | 792 | | |
776 | | this.tcpNoDelay = tcpNoDelay; | | 793 | | this.tcpNoDelay = tcpNoDelay; | | 793 | | this.tcpNoDelay = tcpNoDelay; |
777 | | | | 794 | | | | 794 | | |
778 | | } | | 795 | | } | | 795 | | } |
779 | | | | 796 | | | | 796 | | |
780 | | | | 797 | | | | 797 | | |
781 | | // --------------------------------------------------------- Public Methods | | 798 | | // --------------------------------------------------------- Public Methods | | 798 | | // --------------------------------------------------------- Public Methods |
782 | | | | 799 | | | | 799 | | |
783 | | | | 800 | | | | 800 | | |
784 | | /** | | 801 | | /** | | 801 | | /** |
785 | | * Create (or allocate) and return a Request object suitable for | | 802 | | * Create (or allocate) and return a Request object suitable for | | 802 | | * Create (or allocate) and return a Request object suitable for |
786 | | * specifying the contents of a Request to the responsible Container. | | 803 | | * specifying the contents of a Request to the responsible Container. | | 803 | | * specifying the contents of a Request to the responsible Container. |
787 | | */ | | 804 | | */ | | 804 | | */ |
788 | | public Request createRequest() { | | 805 | | public Request createRequest() { | | 805 | | public Request createRequest() { |
789 | | | | 806 | | | | 806 | | |
790 | | // if (debug >= 2) | | 807 | | // if (debug >= 2) | | 807 | | // if (debug >= 2) |
791 | | // log("createRequest: Creating new request"); | | 808 | | // log("createRequest: Creating new request"); | | 808 | | // log("createRequest: Creating new request"); |
792 | | HttpRequestImpl request = new HttpRequestImpl(); | | 809 | | HttpRequestImpl request = new HttpRequestImpl(); | | 809 | | HttpRequestImpl request = new HttpRequestImpl(); |
793 | | request.setConnector(this); | | 810 | | request.setConnector(this); | | 810 | | request.setConnector(this); |
794 | | return (request); | | 811 | | return (request); | | 811 | | return (request); |
795 | | | | 812 | | | | 812 | | |
796 | | } | | 813 | | } | | 813 | | } |
797 | | | | 814 | | | | 814 | | |
798 | | | | 815 | | | | 815 | | |
799 | | /** | | 816 | | /** | | 816 | | /** |
800 | | * Create (or allocate) and return a Response object suitable for | | 817 | | * Create (or allocate) and return a Response object suitable for | | 817 | | * Create (or allocate) and return a Response object suitable for |
801 | | * receiving the contents of a Response from the responsible Container. | | 818 | | * receiving the contents of a Response from the responsible Container. | | 818 | | * receiving the contents of a Response from the responsible Container. |
802 | | */ | | 819 | | */ | | 819 | | */ |
803 | | public Response createResponse() { | | 820 | | public Response createResponse() { | | 820 | | public Response createResponse() { |
804 | | | | 821 | | | | 821 | | |
805 | | // if (debug >= 2) | | 822 | | // if (debug >= 2) | | 822 | | // if (debug >= 2) |
806 | | // log("createResponse: Creating new response"); | | 823 | | // log("createResponse: Creating new response"); | | 823 | | // log("createResponse: Creating new response"); |
807 | | HttpResponseImpl response = new HttpResponseImpl(); | | 824 | | HttpResponseImpl response = new HttpResponseImpl(); | | 824 | | HttpResponseImpl response = new HttpResponseImpl(); |
808 | | response.setConnector(this); | | 825 | | response.setConnector(this); | | 825 | | response.setConnector(this); |
809 | | return (response); | | 826 | | return (response); | | 826 | | return (response); |
810 | | | | 827 | | | | 827 | | |
811 | | } | | 828 | | } | | 828 | | } |
812 | | | | 829 | | | | 829 | | |
813 | | | | 830 | | | | 830 | | |
814 | | // -------------------------------------------------------- Package Methods | | 831 | | // -------------------------------------------------------- Package Methods | | 831 | | // -------------------------------------------------------- Package Methods |
815 | | | | 832 | | | | 832 | | |
816 | | | | 833 | | | | 833 | | |
817 | | /** | | 834 | | /** | | 834 | | /** |
818 | | * Recycle the specified Processor so that it can be used again. | | 835 | | * Recycle the specified Processor so that it can be used again. | | 835 | | * Recycle the specified Processor so that it can be used again. |
819 | | * | | 836 | | * | | 836 | | * |
820 | | * @param processor The processor to be recycled | | 837 | | * @param processor The processor to be recycled | | 837 | | * @param processor The processor to be recycled |
821 | | */ | | 838 | | */ | | 838 | | */ |
822 | | void recycle(HttpProcessor processor) { | | 839 | | void recycle(HttpProcessor processor) { | | 839 | | void recycle(HttpProcessor processor) { |
823 | | | | 840 | | | | 840 | | |
824 | | // if (debug >= 2) | | 841 | | // if (debug >= 2) | | 841 | | // if (debug >= 2) |
825 | | // log("recycle: Recycling processor " + processor); | | 842 | | // log("recycle: Recycling processor " + processor); | | 842 | | // log("recycle: Recycling processor " + processor); |
826 | | processors.push(processor); | | 843 | | processors.push(processor); | | 843 | | processors.push(processor); |
827 | | | | 844 | | | | 844 | | |
828 | | } | | 845 | | } | | 845 | | } |
829 | | | | 846 | | | | 846 | | |
830 | | | | 847 | | | | 847 | | |
831 | | // -------------------------------------------------------- Private Methods | | 848 | | // -------------------------------------------------------- Private Methods | | 848 | | // -------------------------------------------------------- Private Methods |
832 | | | | 849 | | | | 849 | | |
833 | | | | 850 | | | | 850 | | |
834 | | /** | | 851 | | /** | | 851 | | /** |
835 | | * Create (or allocate) and return an available processor for use in | | 852 | | * Create (or allocate) and return an available processor for use in | | 852 | | * Create (or allocate) and return an available processor for use in |
836 | | * processing a specific HTTP request, if possible. If the maximum | | 853 | | * processing a specific HTTP request, if possible. If the maximum | | 853 | | * processing a specific HTTP request, if possible. If the maximum |
837 | | * allowed processors have already been created and are in use, return | | 854 | | * allowed processors have already been created and are in use, return | | 854 | | * allowed processors have already been created and are in use, return |
838 | | * <code>null</code> instead. | | 855 | | * <code>null</code> instead. | | 855 | | * <code>null</code> instead. |
839 | | */ | | 856 | | */ | | 856 | | */ |
840 | | private HttpProcessor createProcessor() { | | 857 | | private HttpProcessor createProcessor() { | | 857 | | private HttpProcessor createProcessor() { |
841 | | | | 858 | | | | 858 | | |
842 | | synchronized (processors) { | | 859 | | synchronized (processors) { | | 859 | | synchronized (processors) { |
843 | | if (processors.size() > 0) { | | 860 | | if (processors.size() > 0) { | | 860 | | if (processors.size() > 0) { |
844 | | // if (debug >= 2) | | 861 | | // if (debug >= 2) | | 861 | | // if (debug >= 2) |
845 | | // log("createProcessor: Reusing existing processor"); | | 862 | | // log("createProcessor: Reusing existing processor"); | | 862 | | // log("createProcessor: Reusing existing processor"); |
846 | | return ((HttpProcessor) processors.pop()); | | 863 | | return ((HttpProcessor) processors.pop()); | | 863 | | return ((HttpProcessor) processors.pop()); |
847 | | } | | 864 | | } | | 864 | | } |
848 | | if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { | | 865 | | if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { | | 865 | | if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { |
849 | | // if (debug >= 2) | | 866 | | // if (debug >= 2) | | 866 | | // if (debug >= 2) |
850 | | // log("createProcessor: Creating new processor"); | | 867 | | // log("createProcessor: Creating new processor"); | | 867 | | // log("createProcessor: Creating new processor"); |
851 | | return (newProcessor()); | | 868 | | return (newProcessor()); | | 868 | | return (newProcessor()); |
852 | | } else { | | 869 | | } else { | | 869 | | } else { |
853 | | if (maxProcessors < 0) { | | 870 | | if (maxProcessors < 0) { | | 870 | | if (maxProcessors < 0) { |
854 | | // if (debug >= 2) | | 871 | | // if (debug >= 2) | | 871 | | // if (debug >= 2) |
855 | | // log("createProcessor: Creating new processor"); | | 872 | | // log("createProcessor: Creating new processor"); | | 872 | | // log("createProcessor: Creating new processor"); |
856 | | return (newProcessor()); | | 873 | | return (newProcessor()); | | 873 | | return (newProcessor()); |
857 | | } else { | | 874 | | } else { | | 874 | | } else { |
858 | | // if (debug >= 2) | | 875 | | // if (debug >= 2) | | 875 | | // if (debug >= 2) |
859 | | // log("createProcessor: Cannot create new processor"); | | 876 | | // log("createProcessor: Cannot create new processor"); | | 876 | | // log("createProcessor: Cannot create new processor"); |
860 | | return (null); | | 877 | | return (null); | | 877 | | return (null); |
861 | | } | | 878 | | } | | 878 | | } |
862 | | } | | 879 | | } | | 879 | | } |
863 | | } | | 880 | | } | | 880 | | } |
864 | | | | 881 | | | | 881 | | |
865 | | } | | 882 | | } | | 882 | | } |
866 | | | | 883 | | | | 883 | | |
867 | | | | 884 | | | | 884 | | |
868 | | /** | | 885 | | /** | | 885 | | /** |
869 | | * Log a message on the Logger associated with our Container (if any). | | 886 | | * Log a message on the Logger associated with our Container (if any). | | 886 | | * Log a message on the Logger associated with our Container (if any). |
870 | | * | | 887 | | * | | 887 | | * |
871 | | * @param message Message to be logged | | 888 | | * @param message Message to be logged | | 888 | | * @param message Message to be logged |
872 | | */ | | 889 | | */ | | 889 | | */ |
873 | | private void log(String message) { | | 890 | | private void log(String message) { | | 890 | | private void log(String message) { |
874 | | | | 891 | | | | 891 | | |
875 | | Logger logger = container.getLogger(); | | 892 | | Logger logger = container.getLogger(); | | 892 | | Logger logger = container.getLogger(); |
876 | | String localName = threadName; | | 893 | | String localName = threadName; | | 893 | | String localName = threadName; |
877 | | if (localName == null) | | 894 | | if (localName == null) | | 894 | | if (localName == null) |
878 | | localName = "HttpConnector"; | | 895 | | localName = "HttpConnector"; | | 895 | | localName = "HttpConnector"; |
879 | | if (logger != null) | | 896 | | if (logger != null) | | 896 | | if (logger != null) |
880 | | logger.log(localName + " " + message); | | 897 | | logger.log(localName + " " + message); | | 897 | | logger.log(localName + " " + message); |
881 | | else | | 898 | | else | | 898 | | else |
882 | | System.out.println(localName + " " + message); | | 899 | | System.out.println(localName + " " + message); | | 899 | | System.out.println(localName + " " + message); |
883 | | | | 900 | | | | 900 | | |
884 | | } | | 901 | | } | | 901 | | } |
885 | | | | 902 | | | | 902 | | |
886 | | | | 903 | | | | 903 | | |
887 | | /** | | 904 | | /** | | 904 | | /** |
888 | | * Log a message on the Logger associated with our Container (if any). | | 905 | | * Log a message on the Logger associated with our Container (if any). | | 905 | | * Log a message on the Logger associated with our Container (if any). |
889 | | * | | 906 | | * | | 906 | | * |
890 | | * @param message Message to be logged | | 907 | | * @param message Message to be logged | | 907 | | * @param message Message to be logged |
891 | | * @param throwable Associated exception | | 908 | | * @param throwable Associated exception | | 908 | | * @param throwable Associated exception |
892 | | */ | | 909 | | */ | | 909 | | */ |
893 | | private void log(String message, Throwable throwable) { | | 910 | | private void log(String message, Throwable throwable) { | | 910 | | private void log(String message, Throwable throwable) { |
894 | | | | 911 | | | | 911 | | |
895 | | Logger logger = container.getLogger(); | | 912 | | Logger logger = container.getLogger(); | | 912 | | Logger logger = container.getLogger(); |
896 | | String localName = threadName; | | 913 | | String localName = threadName; | | 913 | | String localName = threadName; |
897 | | if (localName == null) | | 914 | | if (localName == null) | | 914 | | if (localName == null) |
898 | | localName = "HttpConnector"; | | 915 | | localName = "HttpConnector"; | | 915 | | localName = "HttpConnector"; |
899 | | if (logger != null) | | 916 | | if (logger != null) | | 916 | | if (logger != null) |
900 | | logger.log(localName + " " + message, throwable); | | 917 | | logger.log(localName + " " + message, throwable); | | 917 | | logger.log(localName + " " + message, throwable); |
901 | | else { | | 918 | | else { | | 918 | | else { |
902 | | System.out.println(localName + " " + message); | | 919 | | System.out.println(localName + " " + message); | | 919 | | System.out.println(localName + " " + message); |
903 | | throwable.printStackTrace(System.out); | | 920 | | throwable.printStackTrace(System.out); | | 920 | | throwable.printStackTrace(System.out); |
904 | | } | | 921 | | } | | 921 | | } |
905 | | | | 922 | | | | 922 | | |
906 | | } | | 923 | | } | | 923 | | } |
907 | | | | 924 | | | | 924 | | |
908 | | | | 925 | | | | 925 | | |
909 | | /** | | 926 | | /** | | 926 | | /** |
910 | | * Create and return a new processor suitable for processing HTTP | | 927 | | * Create and return a new processor suitable for processing HTTP | | 927 | | * Create and return a new processor suitable for processing HTTP |
911 | | * requests and returning the corresponding responses. | | 928 | | * requests and returning the corresponding responses. | | 928 | | * requests and returning the corresponding responses. |
912 | | */ | | 929 | | */ | | 929 | | */ |
913 | | private HttpProcessor newProcessor() { | | 930 | | private HttpProcessor newProcessor() { | | 930 | | private HttpProcessor newProcessor() { |
914 | | | | 931 | | | | 931 | | |
915 | | // if (debug >= 2) | | 932 | | // if (debug >= 2) | | 932 | | // if (debug >= 2) |
916 | | // log("newProcessor: Creating new processor"); | | 933 | | // log("newProcessor: Creating new processor"); | | 933 | | // log("newProcessor: Creating new processor"); |
917 | | HttpProcessor processor = new HttpProcessor(this, curProcessors++); | | 934 | | HttpProcessor processor = new HttpProcessor(this, curProcessors++); | | 934 | | HttpProcessor processor = new HttpProcessor(this, curProcessors++); |
918 | | if (processor instanceof Lifecycle) { | | 935 | | if (processor instanceof Lifecycle) { | | 935 | | if (processor instanceof Lifecycle) { |
919 | | try { | | 936 | | try { | | 936 | | try { |
920 | | ((Lifecycle) processor).start(); | | 937 | | ((Lifecycle) processor).start(); | | 937 | | ((Lifecycle) processor).start(); |
921 | | } catch (LifecycleException e) { | | 938 | | } catch (LifecycleException e) { | | 938 | | } catch (LifecycleException e) { |
922 | | log("newProcessor", e); | | 939 | | log("newProcessor", e); | | 939 | | log("newProcessor", e); |
923 | | return (null); | | 940 | | return (null); | | 940 | | return (null); |
924 | | } | | 941 | | } | | 941 | | } |
925 | | } | | 942 | | } | | 942 | | } |
926 | | created.addElement(processor); | | 943 | | created.addElement(processor); | | 943 | | created.addElement(processor); |
927 | | return (processor); | | 944 | | return (processor); | | 944 | | return (processor); |
928 | | | | 945 | | | | 945 | | |
929 | | } | | 946 | | } | | 946 | | } |
930 | | | | 947 | | | | 947 | | |
931 | | | | 948 | | | | 948 | | |
932 | | /** | | 949 | | /** | | 949 | | /** |
933 | | * Open and return the server socket for this Connector. If an IP | | 950 | | * Open and return the server socket for this Connector. If an IP | | 950 | | * Open and return the server socket for this Connector. If an IP |
934 | | * address has been specified, the socket will be opened only on that | | 951 | | * address has been specified, the socket will be opened only on that | | 951 | | * address has been specified, the socket will be opened only on that |
935 | | * address; otherwise it will be opened on all addresses. | | 952 | | * address; otherwise it will be opened on all addresses. | | 952 | | * address; otherwise it will be opened on all addresses. |
936 | | * | | 953 | | * | | 953 | | * |
937 | | * @exception IOException if an input/output err or occurs | | 954 | | * @exception IOException input/output or network erro r | | 954 | | * @exception IOException input/output or network error |
| | | | 955 | | * @exception KeyStoreException error instantiating the | | 955 | | * @exception KeyStoreException error instantiating the |
| | | | 956 | | * KeyStore from file (SSL only) | | 956 | | * KeyStore from file (SSL only) |
| | | | 957 | | * @exception NoSuchAlgorithmException KeyStore algorithm unsupported | | 957 | | * @exception NoSuchAlgorithmException KeyStore algorithm unsupported |
| | | | 958 | | * by current provider (SSL only) | | 958 | | * by current provider (SSL only) |
| | | | 959 | | * @exception CertificateException general certificate error (SSL only) | | 959 | | * @exception CertificateException general certificate error (SSL only) |
| | | | 960 | | * @exception UnrecoverableKeyException internal KeyStore problem with | | 960 | | * @exception UnrecoverableKeyException internal KeyStore problem with |
| | | | 961 | | * the certificate (SSL only) | | 961 | | * the certificate (SSL only) |
| | | | 962 | | * @exception KeyManagementException problem in the key management | | 962 | | * @exception KeyManagementException problem in the key management |
| | | | 963 | | * layer (SSL only) | | 963 | | * layer (SSL only) |
938 | | */ | | 964 | | */ | | 964 | | */ |
939 | | private ServerSocket open() throws IOException { | | 965 | | private ServerSocket open() | | 965 | | private ServerSocket open() |
| | | | 966 | | throws IOException, KeyStoreException, NoSuchAlgorithmException, | | 966 | | throws IOException, KeyStoreException, NoSuchAlgorithmException, |
| | | | 967 | | CertificateException, UnrecoverableKeyException, | | 967 | | CertificateException, UnrecoverableKeyException, |
| | | | 968 | | KeyManagementException | | 968 | | KeyManagementException |
| | | | 969 | | { | | 969 | | { |
940 | | | | 970 | | | | 970 | | |
941 | | // Acquire the server socket factory for this Connector | | 971 | | // Acquire the server socket factory for this Connector | | 971 | | // Acquire the server socket factory for this Connector |
942 | | ServerSocketFactory factory = getFactory(); | | 972 | | ServerSocketFactory factory = getFactory(); | | 972 | | ServerSocketFactory factory = getFactory(); |
943 | | | | 973 | | | | 973 | | |
944 | | // If no address is specified, open a connection on all addresses | | 974 | | // If no address is specified, open a connection on all addresses | | 974 | | // If no address is specified, open a connection on all addresses |
945 | | if (address == null) { | | 975 | | if (address == null) { | | 975 | | if (address == null) { |
946 | | log(sm.getString("httpConnector.allAddresses")); | | 976 | | log(sm.getString("httpConnector.allAddresses")); | | 976 | | log(sm.getString("httpConnector.allAddresses")); |
947 | | try { | | 977 | | try { | | 977 | | try { |
948 | | return (factory.createSocket(port, acceptCount)); | | 978 | | return (factory.createSocket(port, acceptCount)); | | 978 | | return (factory.createSocket(port, acceptCount)); |
949 | | } catch (BindException be) { | | 979 | | } catch (BindException be) { | | 979 | | } catch (BindException be) { |
950 | | throw new BindException(be.getMessage() + ":" + port); | | 980 | | throw new BindException(be.getMessage() + ":" + port); | | 980 | | throw new BindException(be.getMessage() + ":" + port); |
951 | | } | | 981 | | } | | 981 | | } |
952 | | } | | 982 | | } | | 982 | | } |
953 | | | | 983 | | | | 983 | | |
954 | | // Open a server socket on the specified address | | 984 | | // Open a server socket on the specified address | | 984 | | // Open a server socket on the specified address |
955 | | try { | | 985 | | try { | | 985 | | try { |
956 | | InetAddress is = InetAddress.getByName(address); | | 986 | | InetAddress is = InetAddress.getByName(address); | | 986 | | InetAddress is = InetAddress.getByName(address); |
957 | | log(sm.getString("httpConnector.anAddress", address)); | | 987 | | log(sm.getString("httpConnector.anAddress", address)); | | 987 | | log(sm.getString("httpConnector.anAddress", address)); |
958 | | try { | | 988 | | try { | | 988 | | try { |
959 | | return (factory.createSocket(port, acceptCount, is)); | | 989 | | return (factory.createSocket(port, acceptCount, is)); | | 989 | | return (factory.createSocket(port, acceptCount, is)); |
960 | | } catch (BindException be) { | | 990 | | } catch (BindException be) { | | 990 | | } catch (BindException be) { |
961 | | throw new BindException(be.getMessage() + ":" + address | | 991 | | throw new BindException(be.getMessage() + ":" + address + | | 991 | | throw new BindException(be.getMessage() + ":" + address + |
962 | | + ":" + port); | | 992 | | ":" + port); | | 992 | | ":" + port); |
963 | | } | | 993 | | } | | 993 | | } |
964 | | } catch (Exception e) { | | 994 | | } catch (Exception e) { | | 994 | | } catch (Exception e) { |
965 | | log(sm.getString("httpConnector.noAddress", address)); | | 995 | | log(sm.getString("httpConnector.noAddress", address)); | | 995 | | log(sm.getString("httpConnector.noAddress", address)); |
966 | | try { | | 996 | | try { | | 996 | | try { |
967 | | return (factory.createSocket(port, acceptCount)); | | 997 | | return (factory.createSocket(port, acceptCount)); | | 997 | | return (factory.createSocket(port, acceptCount)); |
968 | | } catch (BindException be) { | | 998 | | } catch (BindException be) { | | 998 | | } catch (BindException be) { |
969 | | throw new BindException(be.getMessage() + ":" + port); | | 999 | | throw new BindException(be.getMessage() + ":" + port); | | 999 | | throw new BindException(be.getMessage() + ":" + port); |
970 | | } | | 1000 | | } | | 1000 | | } |
971 | | } | | 1001 | | } | | 1001 | | } |
972 | | | | 1002 | | | | 1002 | | |
973 | | } | | 1003 | | } | | 1003 | | } |
974 | | | | 1004 | | | | 1004 | | |
975 | | | | 1005 | | | | 1005 | | |
976 | | // ---------------------------------------------- Background Thread Methods | | 1006 | | // ---------------------------------------------- Background Thread Methods | | 1006 | | // ---------------------------------------------- Background Thread Methods |
977 | | | | 1007 | | | | 1007 | | |
978 | | | | 1008 | | | | 1008 | | |
979 | | /** | | 1009 | | /** | | 1009 | | /** |
980 | | * The background thread that listens for incoming TCP/IP connections and | | 1010 | | * The background thread that listens for incoming TCP/IP connections and | | 1010 | | * The background thread that listens for incoming TCP/IP connections and |
981 | | * hands them off to an appropriate processor. | | 1011 | | * hands them off to an appropriate processor. | | 1011 | | * hands them off to an appropriate processor. |
982 | | */ | | 1012 | | */ | | 1012 | | */ |
983 | | public void run() { | | 1013 | | public void run() { | | 1013 | | public void run() { |
984 | | | | 1014 | | | | 1014 | | |
985 | | // Loop until we receive a shutdown command | | 1015 | | // Loop until we receive a shutdown command | | 1015 | | // Loop until we receive a shutdown command |
986 | | while (!stopped) { | | 1016 | | while (!stopped) { | | 1016 | | while (!stopped) { |
987 | | | | 1017 | | | | 1017 | | |
988 | | // Accept the next incoming connection from the server socket | | 1018 | | // Accept the next incoming connection from the server socket | | 1018 | | // Accept the next incoming connection from the server socket |
989 | | Socket socket = null; | | 1019 | | Socket socket = null; | | 1019 | | Socket socket = null; |
990 | | try { | | 1020 | | try { | | 1020 | | try { |
991 | | // if (debug >= 3) | | 1021 | | // if (debug >= 3) | | 1021 | | // if (debug >= 3) |
992 | | // log("run: Waiting on serverSocket.accept()"); | | 1022 | | // log("run: Waiting on serverSocket.accept()"); | | 1022 | | // log("run: Waiting on serverSocket.accept()"); |
993 | | socket = serverSocket.accept(); | | 1023 | | socket = serverSocket.accept(); | | 1023 | | socket = serverSocket.accept(); |
994 | | // if (debug >= 3) | | 1024 | | // if (debug >= 3) | | 1024 | | // if (debug >= 3) |
995 | | // log("run: Returned from serverSocket.accept()"); | | 1025 | | // log("run: Returned from serverSocket.accept()"); | | 1025 | | // log("run: Returned from serverSocket.accept()"); |
996 | | if (connectionTimeout > 0) | | 1026 | | if (connectionTimeout > 0) | | 1026 | | if (connectionTimeout > 0) |
997 | | socket.setSoTimeout(connectionTimeout); | | 1027 | | socket.setSoTimeout(connectionTimeout); | | 1027 | | socket.setSoTimeout(connectionTimeout); |
998 | | socket.setTcpNoDelay(tcpNoDelay); | | 1028 | | socket.setTcpNoDelay(tcpNoDelay); | | 1028 | | socket.setTcpNoDelay(tcpNoDelay); |
999 | | } catch (AccessControlException ace) { | | 1029 | | } catch (AccessControlException ace) { | | 1029 | | } catch (AccessControlException ace) { |
1000 | | log("socket accept security exception", ace); | | 1030 | | log("socket accept security exception", ace); | | 1030 | | log("socket accept security exception", ace); |
1001 | | continue; | | 1031 | | continue; | | 1031 | | continue; |
1002 | | } catch (IOException e) { | | 1032 | | } catch (IOException e) { | | 1032 | | } catch (IOException e) { |
1003 | | // if (debug >= 3) | | 1033 | | // if (debug >= 3) | | 1033 | | // if (debug >= 3) |
1004 | | // log("run: Accept returned IOException", e); | | 1034 | | // log("run: Accept returned IOException", e); | | 1034 | | // log("run: Accept returned IOException", e); |
1005 | | try { | | 1035 | | try { | | 1035 | | try { |
| | | | 1036 | | // If reopening fails, exit | | 1036 | | // If reopening fails, exit |
1006 | | synchronized (threadSync) { | | 1037 | | synchronized (threadSync) { | | 1037 | | synchronized (threadSync) { |
1007 | | if (started && !stopped) | | 1038 | | if (started && !stopped) | | 1038 | | if (started && !stopped) |
1008 | | log("accept : ", e); | | 1039 | | log("accept error: ", e); | | 1039 | | log("accept error: ", e); |
1009 | | if (!stopped) { | | 1040 | | if (!stopped) { | | 1040 | | if (!stopped) { |
1010 | | // if (debug >= 3) | | 1041 | | // if (debug >= 3) | | 1041 | | // if (debug >= 3) |
1011 | | // log("run: Closing server socket"); | | 1042 | | // log("run: Closing server socket"); | | 1042 | | // log("run: Closing server socket"); |
1012 | | serverSocket.close(); | | 1043 | | serverSocket.close(); | | 1043 | | serverSocket.close(); |
1013 | | // if (debug >= 3) | | 1044 | | // if (debug >= 3) | | 1044 | | // if (debug >= 3) |
1014 | | // log("run: Reopening server socket"); | | 1045 | | // log("run: Reopening server socket"); | | 1045 | | // log("run: Reopening server socket"); |
1015 | | serverSocket = open(); | | 1046 | | serverSocket = open(); | | 1046 | | serverSocket = open(); |
1016 | | } | | 1047 | | } | | 1047 | | } |
1017 | | } | | 1048 | | } | | 1048 | | } |
1018 | | // if (debug >= 3) | | 1049 | | // if (debug >= 3) | | 1049 | | // if (debug >= 3) |
1019 | | // log("run: IOException processing completed"); | | 1050 | | // log("run: IOException processing completed"); | | 1050 | | // log("run: IOException processing completed"); |
1020 | | } catch (IOException ex) { | | 1051 | | } catch (IOException ioe ) { | | 1051 | | } catch (IOException ioe) { |
1021 | | // If reopening fai ls, exit | | 1052 | | log("socket reopen, io problem: ", ioe); | | 1052 | | log("socket reopen, io problem: ", ioe); |
1022 | | log("socket reopen : ", ex); | | 1053 | | break; | | 1053 | | break; |
| | | | 1054 | | } catch (KeyStoreException kse) { | | 1054 | | } catch (KeyStoreException kse) { |
| | | | 1055 | | log("socket reopen, keystore problem: ", kse); | | 1055 | | log("socket reopen, keystore problem: ", kse); |
| | | | 1056 | | break; | | 1056 | | break; |
| | | | 1057 | | } catch (NoSuchAlgorithmException nsae) { | | 1057 | | } catch (NoSuchAlgorithmException nsae) { |
| | | | 1058 | | log("socket reopen, keystore algorithm problem: ", nsae); | | 1058 | | log("socket reopen, keystore algorithm problem: ", nsae); |
| | | | 1059 | | break; | | 1059 | | break; |
| | | | 1060 | | } catch (CertificateException ce) { | | 1060 | | } catch (CertificateException ce) { |
| | | | 1061 | | log("socket reopen, certificate problem: ", ce); | | 1061 | | log("socket reopen, certificate problem: ", ce); |
| | | | 1062 | | break; | | 1062 | | break; |
| | | | 1063 | | } catch (UnrecoverableKeyException uke) { | | 1063 | | } catch (UnrecoverableKeyException uke) { |
| | | | 1064 | | log("socket reopen, unrecoverable key: ", uke); | | 1064 | | log("socket reopen, unrecoverable key: ", uke); |
| | | | 1065 | | break; | | 1065 | | break; |
| | | | 1066 | | } catch (KeyManagementException kme) { | | 1066 | | } catch (KeyManagementException kme) { |
| | | | 1067 | | log("socket reopen, key management problem: ", kme ); | | 1067 | | log("socket reopen, key management problem: ", kme); |
1023 | | break; | | 1068 | | break; | | 1068 | | break; |
1024 | | } | | 1069 | | } | | 1069 | | } |
| | | | 1070 | | | | 1070 | | |
1025 | | continue; | | 1071 | | continue; | | 1071 | | continue; |
1026 | | } | | 1072 | | } | | 1072 | | } |
1027 | | | | 1073 | | | | 1073 | | |
1028 | | // Hand this socket off to an appropriate processor | | 1074 | | // Hand this socket off to an appropriate processor | | 1074 | | // Hand this socket off to an appropriate processor |
1029 | | HttpProcessor processor = createProcessor(); | | 1075 | | HttpProcessor processor = createProcessor(); | | 1075 | | HttpProcessor processor = createProcessor(); |
1030 | | if (processor == null) { | | 1076 | | if (processor == null) { | | 1076 | | if (processor == null) { |
1031 | | try { | | 1077 | | try { | | 1077 | | try { |
1032 | | log(sm.getString("httpConnector.noProcessor")); | | 1078 | | log(sm.getString("httpConnector.noProcessor")); | | 1078 | | log(sm.getString("httpConnector.noProcessor")); |
1033 | | socket.close(); | | 1079 | | socket.close(); | | 1079 | | socket.close(); |
1034 | | } catch (IOException e) { | | 1080 | | } catch (IOException e) { | | 1080 | | } catch (IOException e) { |
1035 | | ; | | 1081 | | ; | | 1081 | | ; |
1036 | | } | | 1082 | | } | | 1082 | | } |
1037 | | continue; | | 1083 | | continue; | | 1083 | | continue; |
1038 | | } | | 1084 | | } | | 1084 | | } |
1039 | | // if (debug >= 3) | | 1085 | | // if (debug >= 3) | | 1085 | | // if (debug >= 3) |
1040 | | // log("run: Assigning socket to processor " + processor); | | 1086 | | // log("run: Assigning socket to processor " + processor); | | 1086 | | // log("run: Assigning socket to processor " + processor); |
1041 | | processor.assign(socket); | | 1087 | | processor.assign(socket); | | 1087 | | processor.assign(socket); |
1042 | | | | 1088 | | | | 1088 | | |
1043 | | // The processor will recycle itself when it finishes | | 1089 | | // The processor will recycle itself when it finishes | | 1089 | | // The processor will recycle itself when it finishes |
1044 | | | | 1090 | | | | 1090 | | |
1045 | | } | | 1091 | | } | | 1091 | | } |
1046 | | | | 1092 | | | | 1092 | | |
1047 | | // Notify the threadStop() method that we have shut ourselves down | | 1093 | | // Notify the threadStop() method that we have shut ourselves down | | 1093 | | // Notify the threadStop() method that we have shut ourselves down |
1048 | | // if (debug >= 3) | | 1094 | | // if (debug >= 3) | | 1094 | | // if (debug >= 3) |
1049 | | // log("run: Notifying threadStop() that we have shut down"); | | 1095 | | // log("run: Notifying threadStop() that we have shut down"); | | 1095 | | // log("run: Notifying threadStop() that we have shut down"); |
1050 | | synchronized (threadSync) { | | 1096 | | synchronized (threadSync) { | | 1096 | | synchronized (threadSync) { |
1051 | | threadSync.notifyAll(); | | 1097 | | threadSync.notifyAll(); | | 1097 | | threadSync.notifyAll(); |
1052 | | } | | 1098 | | } | | 1098 | | } |
1053 | | | | 1099 | | | | 1099 | | |
1054 | | } | | 1100 | | } | | 1100 | | } |
1055 | | | | 1101 | | | | 1101 | | |
1056 | | | | 1102 | | | | 1102 | | |
1057 | | /** | | 1103 | | /** | | 1103 | | /** |
1058 | | * Start the background processing thread. | | 1104 | | * Start the background processing thread. | | 1104 | | * Start the background processing thread. |
1059 | | */ | | 1105 | | */ | | 1105 | | */ |
1060 | | private void threadStart() { | | 1106 | | private void threadStart() { | | 1106 | | private void threadStart() { |
1061 | | | | 1107 | | | | 1107 | | |
1062 | | log(sm.getString("httpConnector.starting")); | | 1108 | | log(sm.getString("httpConnector.starting")); | | 1108 | | log(sm.getString("httpConnector.starting")); |
1063 | | | | 1109 | | | | 1109 | | |
1064 | | thread = new Thread(this, threadName); | | 1110 | | thread = new Thread(this, threadName); | | 1110 | | thread = new Thread(this, threadName); |
1065 | | thread.setDaemon(true); | | 1111 | | thread.setDaemon(true); | | 1111 | | thread.setDaemon(true); |
1066 | | thread.start(); | | 1112 | | thread.start(); | | 1112 | | thread.start(); |
1067 | | | | 1113 | | | | 1113 | | |
1068 | | } | | 1114 | | } | | 1114 | | } |
1069 | | | | 1115 | | | | 1115 | | |
1070 | | | | 1116 | | | | 1116 | | |
1071 | | /** | | 1117 | | /** | | 1117 | | /** |
1072 | | * Stop the background processing thread. | | 1118 | | * Stop the background processing thread. | | 1118 | | * Stop the background processing thread. |
1073 | | */ | | 1119 | | */ | | 1119 | | */ |
1074 | | private void threadStop() { | | 1120 | | private void threadStop() { | | 1120 | | private void threadStop() { |
1075 | | | | 1121 | | | | 1121 | | |
1076 | | log(sm.getString("httpConnector.stopping")); | | 1122 | | log(sm.getString("httpConnector.stopping")); | | 1122 | | log(sm.getString("httpConnector.stopping")); |
1077 | | | | 1123 | | | | 1123 | | |
1078 | | stopped = true; | | 1124 | | stopped = true; | | 1124 | | stopped = true; |
1079 | | try { | | 1125 | | try { | | 1125 | | try { |
1080 | | threadSync.wait(5000); | | 1126 | | threadSync.wait(5000); | | 1126 | | threadSync.wait(5000); |
1081 | | } catch (InterruptedException e) { | | 1127 | | } catch (InterruptedException e) { | | 1127 | | } catch (InterruptedException e) { |
1082 | | ; | | 1128 | | ; | | 1128 | | ; |
1083 | | } | | 1129 | | } | | 1129 | | } |
1084 | | thread = null; | | 1130 | | thread = null; | | 1130 | | thread = null; |
1085 | | | | 1131 | | | | 1131 | | |
1086 | | } | | 1132 | | } | | 1132 | | } |
1087 | | | | 1133 | | | | 1133 | | |
1088 | | | | 1134 | | | | 1134 | | |
1089 | | // ------------------------------------------------------ Lifecycle Methods | | 1135 | | // ------------------------------------------------------ Lifecycle Methods | | 1135 | | // ------------------------------------------------------ Lifecycle Methods |
1090 | | | | 1136 | | | | 1136 | | |
1091 | | | | 1137 | | | | 1137 | | |
1092 | | /** | | 1138 | | /** | | 1138 | | /** |
1093 | | * Add a lifecycle event listener to this component. | | 1139 | | * Add a lifecycle event listener to this component. | | 1139 | | * Add a lifecycle event listener to this component. |
1094 | | * | | 1140 | | * | | 1140 | | * |
1095 | | * @param listener The listener to add | | 1141 | | * @param listener The listener to add | | 1141 | | * @param listener The listener to add |
1096 | | */ | | 1142 | | */ | | 1142 | | */ |
1097 | | public void addLifecycleListener(LifecycleListener listener) { | | 1143 | | public void addLifecycleListener(LifecycleListener listener) { | | 1143 | | public void addLifecycleListener(LifecycleListener listener) { |
1098 | | | | 1144 | | | | 1144 | | |
1099 | | lifecycle.addLifecycleListener(listener); | | 1145 | | lifecycle.addLifecycleListener(listener); | | 1145 | | lifecycle.addLifecycleListener(listener); |
1100 | | | | 1146 | | | | 1146 | | |
1101 | | } | | 1147 | | } | | 1147 | | } |
1102 | | | | 1148 | | | | 1148 | | |
1103 | | | | 1149 | | | | 1149 | | |
1104 | | /** | | 1150 | | /** | | 1150 | | /** |
| | | | 1151 | | * Get the lifecycle listeners associated with this lifecycle. If this | | 1151 | | * Get the lifecycle listeners associated with this lifecycle. If this |
| | | | 1152 | | * Lifecycle has no listeners registered, a zero-length array is returned. | | 1152 | | * Lifecycle has no listeners registered, a zero-length array is returned. |
| | | | 1153 | | */ | | 1153 | | */ |
| | | | 1154 | | public LifecycleListener[] findLifecycleListeners() { | | 1154 | | public LifecycleListener[] findLifecycleListeners() { |
| | | | 1155 | | | | 1155 | | |
| | | | 1156 | | return lifecycle.findLifecycleListeners(); | | 1156 | | return lifecycle.findLifecycleListeners(); |
| | | | 1157 | | | | 1157 | | |
| | | | 1158 | | } | | 1158 | | } |
| | | | 1159 | | | | 1159 | | |
| | | | 1160 | | | | 1160 | | |
| | | | 1161 | | /** | | 1161 | | /** |
1105 | | * Remove a lifecycle event listener from this component. | | 1162 | | * Remove a lifecycle event listener from this component. | | 1162 | | * Remove a lifecycle event listener from this component. |
1106 | | * | | 1163 | | * | | 1163 | | * |
1107 | | * @param listener The listener to add | | 1164 | | * @param listener The listener to add | | 1164 | | * @param listener The listener to add |
1108 | | */ | | 1165 | | */ | | 1165 | | */ |
1109 | | public void removeLifecycleListener(LifecycleListener listener) { | | 1166 | | public void removeLifecycleListener(LifecycleListener listener) { | | 1166 | | public void removeLifecycleListener(LifecycleListener listener) { |
1110 | | | | 1167 | | | | 1167 | | |
1111 | | lifecycle.removeLifecycleListener(listener); | | 1168 | | lifecycle.removeLifecycleListener(listener); | | 1168 | | lifecycle.removeLifecycleListener(listener); |
1112 | | | | 1169 | | | | 1169 | | |
1113 | | } | | 1170 | | } | | 1170 | | } |
1114 | | | | 1171 | | | | 1171 | | |
1115 | | | | 1172 | | | | 1172 | | |
1116 | | /** | | 1173 | | /** | | 1173 | | /** |
1117 | | * Initialize this connector (create ServerSocket here!) | | 1174 | | * Initialize this connector (create ServerSocket here!) | | 1174 | | * Initialize this connector (create ServerSocket here!) |
1118 | | */ | | 1175 | | */ | | 1175 | | */ |
1119 | | public void initialize() | | 1176 | | public void initialize() | | 1176 | | public void initialize() |
1120 | | throws LifecycleException { | | 1177 | | throws LifecycleException { | | 1177 | | throws LifecycleException { |
1121 | | if (initialized) | | 1178 | | if (initialized) | | 1178 | | if (initialized) |
1122 | | throw new LifecycleException ( | | 1179 | | throw new LifecycleException ( | | 1179 | | throw new LifecycleException ( |
1123 | | sm.getString("httpConnector.alreadyInitialized")); | | 1180 | | sm.getString("httpConnector.alreadyInitialized")); | | 1180 | | sm.getString("httpConnector.alreadyInitialized")); |
| | | | 1181 | | | | 1181 | | |
1124 | | this.initialized=true; | | 1182 | | this.initialized=true; | | 1182 | | this.initialized=true; |
| | | | 1183 | | Exception eRethrow = null; | | 1183 | | Exception eRethrow = null; |
1125 | | | | 1184 | | | | 1184 | | |
1126 | | // Establish a server socket on the specified port | | 1185 | | // Establish a server socket on the specified port | | 1185 | | // Establish a server socket on the specified port |
1127 | | try { | | 1186 | | try { | | 1186 | | try { |
1128 | | serverSocket = open(); | | 1187 | | serverSocket = open(); | | 1187 | | serverSocket = open(); |
1129 | | } catch (IOException e) { | | 1188 | | } catch (IOException ioe) { | | 1188 | | } catch (IOException ioe) { |
1130 | | throw new LifecycleException(threadName + ".o p en", e); | | 1189 | | log("httpConne c t o r, io problem: ", ioe); | | 1189 | | log("httpConnector, io problem: ", ioe); |
| | | | 1190 | | eRethrow = ioe; | | 1190 | | eRethrow = ioe; |
| | | | 1191 | | } catch (KeyStoreException kse) { | | 1191 | | } catch (KeyStoreException kse) { |
| | | | 1192 | | log("httpConnector, keystore problem: ", kse); | | 1192 | | log("httpConnector, keystore problem: ", kse); |
| | | | 1193 | | eRethrow = kse; | | 1193 | | eRethrow = kse; |
| | | | 1194 | | } catch (NoSuchAlgorithmException nsae) { | | 1194 | | } catch (NoSuchAlgorithmException nsae) { |
| | | | 1195 | | log("httpConnector, keystore algorithm problem: ", nsae); | | 1195 | | log("httpConnector, keystore algorithm problem: ", nsae); |
| | | | 1196 | | eRethrow = nsae; | | 1196 | | eRethrow = nsae; |
| | | | 1197 | | } catch (CertificateException ce) { | | 1197 | | } catch (CertificateException ce) { |
| | | | 1198 | | log("httpConnector, certificate problem: ", ce); | | 1198 | | log("httpConnector, certificate problem: ", ce); |
| | | | 1199 | | eRethrow = ce; | | 1199 | | eRethrow = ce; |
| | | | 1200 | | } catch (UnrecoverableKeyException uke) { | | 1200 | | } catch (UnrecoverableKeyException uke) { |
| | | | 1201 | | log("httpConnector, unrecoverable key: ", uke); | | 1201 | | log("httpConnector, unrecoverable key: ", uke); |
| | | | 1202 | | eRethrow = uke; | | 1202 | | eRethrow = uke; |
| | | | 1203 | | } catch (KeyManagementException kme) { | | 1203 | | } catch (KeyManagementException kme) { |
| | | | 1204 | | log("httpConnector, key management problem: ", kme); | | 1204 | | log("httpConnector, key management problem: ", kme); |
| | | | 1205 | | eRethrow = kme; | | 1205 | | eRethrow = kme; |
1131 | | } | | 1206 | | } | | 1206 | | } |
1132 | | | | 1207 | | | | 1207 | | |
| | | | 1208 | | if ( eRethrow != null ) | | 1208 | | if ( eRethrow != null ) |
| | | | 1209 | | throw new LifecycleException(threadName + ".open", eRethrow); | | 1209 | | throw new LifecycleException(threadName + ".open", eRethrow); |
| | | | 1210 | | | | 1210 | | |
1133 | | } | | 1211 | | } | | 1211 | | } |
1134 | | | | 1212 | | | | 1212 | | |
1135 | | | | 1213 | | | | 1213 | | |
1136 | | /** | | 1214 | | /** | | 1214 | | /** |
1137 | | * Begin processing requests via this Connector. | | 1215 | | * Begin processing requests via this Connector. | | 1215 | | * Begin processing requests via this Connector. |
1138 | | * | | 1216 | | * | | 1216 | | * |
1139 | | * @exception LifecycleException if a fatal startup error occurs | | 1217 | | * @exception LifecycleException if a fatal startup error occurs | | 1217 | | * @exception LifecycleException if a fatal startup error occurs |
1140 | | */ | | 1218 | | */ | | 1218 | | */ |
1141 | | public void start() throws LifecycleException { | | 1219 | | public void start() throws LifecycleException { | | 1219 | | public void start() throws LifecycleException { |
1142 | | | | 1220 | | | | 1220 | | |
1143 | | // Validate and update our current state | | 1221 | | // Validate and update our current state | | 1221 | | // Validate and update our current state |
1144 | | if (started) | | 1222 | | if (started) | | 1222 | | if (started) |
1145 | | throw new LifecycleException | | 1223 | | throw new LifecycleException | | 1223 | | throw new LifecycleException |
1146 | | (sm.getString("httpConnector.alreadyStarted")); | | 1224 | | (sm.getString("httpConnector.alreadyStarted")); | | 1224 | | (sm.getString("httpConnector.alreadyStarted")); |
1147 | | threadName = "HttpConnector[" + port + "]"; | | 1225 | | threadName = "HttpConnector[" + port + "]"; | | 1225 | | threadName = "HttpConnector[" + port + "]"; |
1148 | | lifecycle.fireLifecycleEvent(START_EVENT, null); | | 1226 | | lifecycle.fireLifecycleEvent(START_EVENT, null); | | 1226 | | lifecycle.fireLifecycleEvent(START_EVENT, null); |
1149 | | started = true; | | 1227 | | started = true; | | 1227 | | started = true; |
1150 | | | | 1228 | | | | 1228 | | |
1151 | | // Start our background thread | | 1229 | | // Start our background thread | | 1229 | | // Start our background thread |
1152 | | threadStart(); | | 1230 | | threadStart(); | | 1230 | | threadStart(); |
1153 | | | | 1231 | | | | 1231 | | |
1154 | | // Create the specified minimum number of processors | | 1232 | | // Create the specified minimum number of processors | | 1232 | | // Create the specified minimum number of processors |
1155 | | while (curProcessors < minProcessors) { | | 1233 | | while (curProcessors < minProcessors) { | | 1233 | | while (curProcessors < minProcessors) { |
1156 | | if ((maxProcessors > 0) && (curProcessors >= maxProcessors)) | | 1234 | | if ((maxProcessors > 0) && (curProcessors >= maxProcessors)) | | 1234 | | if ((maxProcessors > 0) && (curProcessors >= maxProcessors)) |
1157 | | break; | | 1235 | | break; | | 1235 | | break; |
1158 | | HttpProcessor processor = newProcessor(); | | 1236 | | HttpProcessor processor = newProcessor(); | | 1236 | | HttpProcessor processor = newProcessor(); |
1159 | | recycle(processor); | | 1237 | | recycle(processor); | | 1237 | | recycle(processor); |
1160 | | } | | 1238 | | } | | 1238 | | } |
1161 | | | | 1239 | | | | 1239 | | |
1162 | | } | | 1240 | | } | | 1240 | | } |
1163 | | | | 1241 | | | | 1241 | | |
1164 | | | | 1242 | | | | 1242 | | |
1165 | | /** | | 1243 | | /** | | 1243 | | /** |
1166 | | * Terminate processing requests via this Connector. | | 1244 | | * Terminate processing requests via this Connector. | | 1244 | | * Terminate processing requests via this Connector. |
1167 | | * | | 1245 | | * | | 1245 | | * |
1168 | | * @exception LifecycleException if a fatal shutdown error occurs | | 1246 | | * @exception LifecycleException if a fatal shutdown error occurs | | 1246 | | * @exception LifecycleException if a fatal shutdown error occurs |
1169 | | */ | | 1247 | | */ | | 1247 | | */ |
1170 | | public void stop() throws LifecycleException { | | 1248 | | public void stop() throws LifecycleException { | | 1248 | | public void stop() throws LifecycleException { |
1171 | | | | 1249 | | | | 1249 | | |
1172 | | // Validate and update our current state | | 1250 | | // Validate and update our current state | | 1250 | | // Validate and update our current state |
1173 | | if (!started) | | 1251 | | if (!started) | | 1251 | | if (!started) |
1174 | | throw new LifecycleException | | 1252 | | throw new LifecycleException | | 1252 | | throw new LifecycleException |
1175 | | (sm.getString("httpConnector.notStarted")); | | 1253 | | (sm.getString("httpConnector.notStarted")); | | 1253 | | (sm.getString("httpConnector.notStarted")); |
1176 | | lifecycle.fireLifecycleEvent(STOP_EVENT, null); | | 1254 | | lifecycle.fireLifecycleEvent(STOP_EVENT, null); | | 1254 | | lifecycle.fireLifecycleEvent(STOP_EVENT, null); |
1177 | | started = false; | | 1255 | | started = false; | | 1255 | | started = false; |
1178 | | | | 1256 | | | | 1256 | | |
1179 | | // Gracefully shut down all processors we have created | | 1257 | | // Gracefully shut down all processors we have created | | 1257 | | // Gracefully shut down all processors we have created |
1180 | | for (int i = created.size() - 1; i >= 0; i--) { | | 1258 | | for (int i = created.size() - 1; i >= 0; i--) { | | 1258 | | for (int i = created.size() - 1; i >= 0; i--) { |
1181 | | HttpProcessor processor = (HttpProcessor) created.elementAt(i); | | 1259 | | HttpProcessor processor = (HttpProcessor) created.elementAt(i); | | 1259 | | HttpProcessor processor = (HttpProcessor) created.elementAt(i); |
1182 | | if (processor instanceof Lifecycle) { | | 1260 | | if (processor instanceof Lifecycle) { | | 1260 | | if (processor instanceof Lifecycle) { |
1183 | | try { | | 1261 | | try { | | 1261 | | try { |
1184 | | ((Lifecycle) processor).stop(); | | 1262 | | ((Lifecycle) processor).stop(); | | 1262 | | ((Lifecycle) processor).stop(); |
1185 | | } catch (LifecycleException e) { | | 1263 | | } catch (LifecycleException e) { | | 1263 | | } catch (LifecycleException e) { |
1186 | | log("HttpConnector.stop", e); | | 1264 | | log("HttpConnector.stop", e); | | 1264 | | log("HttpConnector.stop", e); |
1187 | | } | | 1265 | | } | | 1265 | | } |
1188 | | } | | 1266 | | } | | 1266 | | } |
1189 | | } | | 1267 | | } | | 1267 | | } |
1190 | | | | 1268 | | | | 1268 | | |
1191 | | synchronized (threadSync) { | | 1269 | | synchronized (threadSync) { | | 1269 | | synchronized (threadSync) { |
1192 | | // Close the server socket we were using | | 1270 | | // Close the server socket we were using | | 1270 | | // Close the server socket we were using |
1193 | | if (serverSocket != null) { | | 1271 | | if (serverSocket != null) { | | 1271 | | if (serverSocket != null) { |
1194 | | try { | | 1272 | | try { | | 1272 | | try { |
1195 | | serverSocket.close(); | | 1273 | | serverSocket.close(); | | 1273 | | serverSocket.close(); |
1196 | | } catch (IOException e) { | | 1274 | | } catch (IOException e) { | | 1274 | | } catch (IOException e) { |
1197 | | ; | | 1275 | | ; | | 1275 | | ; |
1198 | | } | | 1276 | | } | | 1276 | | } |
1199 | | } | | 1277 | | } | | 1277 | | } |
1200 | | // Stop our background thread | | 1278 | | // Stop our background thread | | 1278 | | // Stop our background thread |
1201 | | threadStop(); | | 1279 | | threadStop(); | | 1279 | | threadStop(); |
1202 | | } | | 1280 | | } | | 1280 | | } |
1203 | | serverSocket = null; | | 1281 | | serverSocket = null; | | 1281 | | serverSocket = null; |
1204 | | | | 1282 | | | | 1282 | | |
1205 | | } | | 1283 | | } | | 1283 | | } |
1206 | | | | 1284 | | | | 1284 | | |
1207 | | | | 1285 | | | | 1285 | | |
1208 | | } | | 1286 | | } | | 1286 | | } |