annotate src/org/eclipse/jetty/server/Connector.java @ 864:e21ca9878a10

simplify ThreadPool use
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 02 Oct 2016 16:17:38 -0600
parents ad292e148964
children 6b210bb66c63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 package org.eclipse.jetty.server;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import org.eclipse.jetty.io.Buffers;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import org.eclipse.jetty.io.EndPoint;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 import org.eclipse.jetty.util.component.LifeCycle;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import org.eclipse.jetty.util.thread.ThreadPool;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 /** HTTP Connector.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 * Implementations of this interface provide connectors for the HTTP protocol.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 * A connector receives requests (normally from a socket) and calls the
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 * handle method of the Handler object. These operations are performed using
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 * threads from the ThreadPool set on the connector.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 * When a connector is registered with an instance of Server, then the server
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 * will set itself as both the ThreadPool and the Handler. Note that a connector
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 * can be used without a Server if a thread pool and handler are directly provided.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 /**
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 * @author gregw
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 public interface Connector extends LifeCycle
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 {
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
47 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
48 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
49 * @return the name of the connector. Defaults to the HostName:port
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
50 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
51 String getName();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
52
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
53 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
54 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
55 * Opens the connector
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
56 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
57 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
58 void open() throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
59
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
60 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
61 void close() throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
63 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
64 void setServer(Server server);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
65
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
66 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
67 Server getServer();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
68
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
69 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
70 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
71 * @return Returns the request header buffer size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
72 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
73 int getRequestHeaderSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
74
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
75 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
76 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
77 * Set the size of the buffer to be used for request headers.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
78 * @param size The size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
79 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
80 void setRequestHeaderSize(int size);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
81
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
82 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
83 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
84 * @return Returns the response header buffer size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
85 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
86 int getResponseHeaderSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
87
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
88 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
89 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
90 * Set the size of the buffer to be used for request headers.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
91 * @param size The size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
92 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
93 void setResponseHeaderSize(int size);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
94
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
95
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
96 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
97 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
98 * @return factory for request buffers
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
99 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
100 Buffers getRequestBuffers();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
101
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
102 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
103 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
104 * @return factory for response buffers
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
105 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
106 Buffers getResponseBuffers();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
107
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
108
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
109 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
110 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
111 * @return Returns the requestBufferSize.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
112 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
113 int getRequestBufferSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
114
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
115 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
116 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
117 * Set the size of the content buffer for receiving requests.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
118 * These buffers are only used for active connections that have
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
119 * requests with bodies that will not fit within the header buffer.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
120 * @param requestBufferSize The requestBufferSize to set.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
121 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
122 void setRequestBufferSize(int requestBufferSize);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
123
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
124 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
125 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
126 * @return Returns the responseBufferSize.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
127 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
128 int getResponseBufferSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
129
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
130 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
131 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
132 * Set the size of the content buffer for sending responses.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
133 * These buffers are only used for active connections that are sending
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
134 * responses with bodies that will not fit within the header buffer.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
135 * @param responseBufferSize The responseBufferSize to set.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
136 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
137 void setResponseBufferSize(int responseBufferSize);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
138
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
139
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
140 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
141 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
142 * @return The port to use when redirecting a request if a data constraint of integral is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
143 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
144 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
145 int getIntegralPort();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
146
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
147 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
148 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
149 * @return The schema to use when redirecting a request if a data constraint of integral is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
150 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
151 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
152 String getIntegralScheme();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
153
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
154 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
155 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
156 * @param request A request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
157 * @return true if the request is integral. This normally means the https schema has been used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
158 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
159 boolean isIntegral(Request request);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
160
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
161 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
162 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
163 * @return The port to use when redirecting a request if a data constraint of confidential is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
164 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
165 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
166 int getConfidentialPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
167
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
168
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
169 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
170 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
171 * @return The schema to use when redirecting a request if a data constraint of confidential is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
172 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
173 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
174 String getConfidentialScheme();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
175
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
176 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
177 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
178 * @param request A request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
179 * @return true if the request is confidential. This normally means the https schema has been used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
180 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
181 boolean isConfidential(Request request);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
182
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
183 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
184 /** Customize a request for an endpoint.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
185 * Called on every request to allow customization of the request for
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
186 * the particular endpoint (eg security properties from a SSL connection).
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
187 * @param endpoint
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
188 * @param request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
189 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
190 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
191 void customize(EndPoint endpoint, Request request) throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
192
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
193 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
194 /** Persist an endpoint.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
195 * Called after every request if the connection is to remain open.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
196 * @param endpoint
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
197 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
198 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
199 void persist(EndPoint endpoint) throws IOException;
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
200
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
201 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
202 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
203 * @return The hostname representing the interface to which
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
204 * this connector will bind, or null for all interfaces.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
205 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
206 String getHost();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
207
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
208 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
209 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
210 * Set the hostname of the interface to bind to.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
211 * @param hostname The hostname representing the interface to which
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
212 * this connector will bind, or null for all interfaces.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
213 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
214 void setHost(String hostname);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
215
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
216 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
217 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
218 * @param port The port to listen of for connections or 0 if any available
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
219 * port may be used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
220 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
221 void setPort(int port);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
222
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
223 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
224 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
225 * @return The configured port for the connector or 0 if any available
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
226 * port may be used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
227 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
228 int getPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
229
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
230 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
231 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
232 * @return The actual port the connector is listening on or
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
233 * -1 if it has not been opened, or -2 if it has been closed.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
234 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
235 int getLocalPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
236
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
237 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
238 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
239 * @return Max Idle time for connections in milliseconds
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
240 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
241 int getMaxIdleTime();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
242
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
243 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
244 * @param ms Max Idle time for connections in milliseconds
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
245 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
246 void setMaxIdleTime(int ms);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
247
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
248 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
249 int getLowResourceMaxIdleTime();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
250 void setLowResourceMaxIdleTime(int ms);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
251
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
252 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
253 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
254 * @return the underlying socket, channel, buffer etc. for the connector.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
255 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
256 Object getConnection();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
257
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
258
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
259 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
260 /**
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
261 * @return true if names resolution should be done.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
262 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
263 boolean getResolveNames();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
264
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
265
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
266
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
267 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
268 /** Check if low on resources.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
269 * For most connectors, low resources is measured by calling
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
270 * {@link ThreadPool#isLowOnThreads()} on the connector threadpool
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
271 * or the server threadpool if there is no connector threadpool.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
272 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
273 * For blocking connectors, low resources is used to trigger
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
274 * usage of {@link #getLowResourceMaxIdleTime()} for the timeout
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
275 * of an idle connection.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
276 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
277 * for non-blocking connectors, the number of connections is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
278 * used instead of this method, to select the timeout of an
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
279 * idle connection.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
280 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
281 * For all connectors, low resources is used to trigger the
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
282 * usage of {@link #getLowResourceMaxIdleTime()} for read and
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
283 * write operations.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
284 *
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
285 * @return true if this connector is low on resources.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
286 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
287 public boolean isLowResources();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
288 }