annotate src/org/eclipse/jetty/server/Connector.java @ 881:31e803481e33

remove UncheckedIOException
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 16:04:32 -0600
parents 6b210bb66c63
children 150092cebf3e
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
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 /** HTTP Connector.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 * Implementations of this interface provide connectors for the HTTP protocol.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 * 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
30 * 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
31 * threads from the ThreadPool set on the connector.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 * 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
34 * 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
35 * 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
36 *
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 * @author gregw
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 *
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 public interface Connector extends LifeCycle
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 {
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
46 /* ------------------------------------------------------------ */
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 * @return the name of the connector. Defaults to the HostName:port
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
49 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
50 String getName();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
51
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 * Opens the connector
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
55 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
56 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
57 void open() throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
58
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
59 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
60 void close() throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
61
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
62 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
63 void setServer(Server server);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
64
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 Server getServer();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
67
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
68 /* ------------------------------------------------------------ */
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 * @return Returns the request header buffer size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
71 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
72 int getRequestHeaderSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
73
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 * 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
77 * @param size The size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
78 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
79 void setRequestHeaderSize(int size);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
80
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
81 /* ------------------------------------------------------------ */
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 * @return Returns the response header buffer size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
84 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
85 int getResponseHeaderSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
86
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 * 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
90 * @param size The size in bytes.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
91 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
92 void setResponseHeaderSize(int size);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
93
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
94
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
95 /* ------------------------------------------------------------ */
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 * @return factory for request buffers
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
98 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
99 Buffers getRequestBuffers();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
100
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
101 /* ------------------------------------------------------------ */
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 * @return factory for response buffers
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
104 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
105 Buffers getResponseBuffers();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
106
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 * @return Returns the requestBufferSize.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
111 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
112 int getRequestBufferSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
113
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 * Set the size of the content buffer for receiving requests.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
117 * These buffers are only used for active connections that have
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
118 * requests with bodies that will not fit within the header buffer.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
119 * @param requestBufferSize The requestBufferSize to set.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
120 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
121 void setRequestBufferSize(int requestBufferSize);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
122
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 * @return Returns the responseBufferSize.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
126 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
127 int getResponseBufferSize();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
128
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 * Set the size of the content buffer for sending responses.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
132 * These buffers are only used for active connections that are sending
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
133 * responses with bodies that will not fit within the header buffer.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
134 * @param responseBufferSize The responseBufferSize to set.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
135 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
136 void setResponseBufferSize(int responseBufferSize);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
137
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
138
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
139 /* ------------------------------------------------------------ */
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 * @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
142 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
143 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
144 int getIntegralPort();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
145
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
146 /* ------------------------------------------------------------ */
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 * @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
149 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
150 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
151 String getIntegralScheme();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
152
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
153 /* ------------------------------------------------------------ */
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 * @param request A request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
156 * @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
157 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
158 boolean isIntegral(Request request);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
159
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
160 /* ------------------------------------------------------------ */
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 * @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
163 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
164 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
165 int getConfidentialPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
166
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 * @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
171 * required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
172 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
173 String getConfidentialScheme();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
174
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 * @param request A request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
178 * @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
179 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
180 boolean isConfidential(Request request);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
181
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
182 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
183 /** Customize a request for an endpoint.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
184 * Called on every request to allow customization of the request for
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
185 * the particular endpoint (eg security properties from a SSL connection).
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
186 * @param endpoint
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
187 * @param request
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
188 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
189 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
190 void customize(EndPoint endpoint, Request request) throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
191
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
192 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
193 /** Persist an endpoint.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
194 * Called after every request if the connection is to remain open.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
195 * @param endpoint
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
196 * @throws IOException
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
197 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
198 void persist(EndPoint endpoint) throws IOException;
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
199
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 * @return The hostname representing the interface to which
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
203 * this connector will bind, or null for all interfaces.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
204 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
205 String getHost();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
206
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 * Set the hostname of the interface to bind to.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
210 * @param hostname The hostname representing the interface to which
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
211 * this connector will bind, or null for all interfaces.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
212 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
213 void setHost(String hostname);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
214
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
215 /* ------------------------------------------------------------ */
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 * @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
218 * port may be used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
219 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
220 void setPort(int port);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
221
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 * @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
225 * port may be used.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
226 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
227 int getPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
228
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 * @return The actual port the connector is listening on or
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
232 * -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
233 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
234 int getLocalPort();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
235
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 * @return Max Idle time for connections in milliseconds
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
239 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
240 int getMaxIdleTime();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
241
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 * @param ms Max Idle time for connections in milliseconds
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
244 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
245 void setMaxIdleTime(int ms);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
246
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 int getLowResourceMaxIdleTime();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
249 void setLowResourceMaxIdleTime(int ms);
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
250
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 * @return the underlying socket, channel, buffer etc. for the connector.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
254 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
255 Object getConnection();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
256
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 * @return true if names resolution should be done.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
261 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
262 boolean getResolveNames();
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
263
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
264
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
265
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
266 /* ------------------------------------------------------------ */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
267 /** Check if low on resources.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
268 * For most connectors, low resources is measured by calling
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 818
diff changeset
269 * {@link Server#isLowOnThreads()} on the connector threadpool
818
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
270 * or the server threadpool if there is no connector threadpool.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
271 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
272 * For blocking connectors, low resources is used to trigger
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
273 * usage of {@link #getLowResourceMaxIdleTime()} for the timeout
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
274 * of an idle connection.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
275 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
276 * for non-blocking connectors, the number of connections is
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
277 * used instead of this method, to select the timeout of an
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
278 * idle connection.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
279 * <p>
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
280 * For all connectors, low resources is used to trigger the
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
281 * usage of {@link #getLowResourceMaxIdleTime()} for read and
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
282 * write operations.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
283 *
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
284 * @return true if this connector is low on resources.
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
285 */
ad292e148964 remove util/statistic
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
286 public boolean isLowResources();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
287 }