OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * HTTP status codes. | 6 * HTTP status codes. |
7 */ | 7 */ |
8 abstract class HttpStatus { | 8 abstract class HttpStatus { |
9 static const int CONTINUE = 100; | 9 static const int CONTINUE = 100; |
10 static const int SWITCHING_PROTOCOLS = 101; | 10 static const int SWITCHING_PROTOCOLS = 101; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 /** | 110 /** |
111 * Sets the error handler that is called when a connection error occurs. | 111 * Sets the error handler that is called when a connection error occurs. |
112 */ | 112 */ |
113 void set onError(void callback(e)); | 113 void set onError(void callback(e)); |
114 | 114 |
115 /** | 115 /** |
116 * Set the timeout, in seconds, for sessions of this HTTP server. Default | 116 * Set the timeout, in seconds, for sessions of this HTTP server. Default |
117 * is 20 minutes. | 117 * is 20 minutes. |
118 */ | 118 */ |
119 set sessionTimeout(int timeout); | 119 set sessionTimeout(int timeout); |
| 120 |
| 121 /** |
| 122 * Returns a [:HttpConnectionsInfo:] object with an overview of the |
| 123 * current connection handled by the server. |
| 124 */ |
| 125 HttpConnectionsInfo connectionsInfo(); |
120 } | 126 } |
121 | 127 |
122 | 128 |
| 129 /** |
| 130 * Overview information of the [:HttpServer:] socket connections. |
| 131 */ |
| 132 class HttpConnectionsInfo { |
| 133 /** |
| 134 * Total number of socket connections. |
| 135 */ |
| 136 int total = 0; |
| 137 |
| 138 /** |
| 139 * Number of active connections where actual request/response |
| 140 * processing is active. |
| 141 */ |
| 142 int active = 0; |
| 143 |
| 144 /** |
| 145 * Number of idle connections held by clients as persistent connections. |
| 146 */ |
| 147 int idle = 0; |
| 148 |
| 149 /** |
| 150 * Number of connections which are preparing to close. Note: These |
| 151 * connections are also part of the [:active:] count as they might |
| 152 * still be sending data to the client before finally closing. |
| 153 */ |
| 154 int closing = 0; |
| 155 } |
| 156 |
| 157 |
123 /** | 158 /** |
124 * Access to the HTTP headers for requests and responses. In some | 159 * Access to the HTTP headers for requests and responses. In some |
125 * situations the headers will be imutable and the mutating methods | 160 * situations the headers will be imutable and the mutating methods |
126 * will then throw exceptions. | 161 * will then throw exceptions. |
127 * | 162 * |
128 * For all operation on HTTP headers the header name is | 163 * For all operation on HTTP headers the header name is |
129 * case-insensitive. | 164 * case-insensitive. |
130 */ | 165 */ |
131 abstract class HttpHeaders { | 166 abstract class HttpHeaders { |
132 static const ACCEPT = "Accept"; | 167 static const ACCEPT = "Accept"; |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 class RedirectLimitExceededException extends RedirectException { | 1085 class RedirectLimitExceededException extends RedirectException { |
1051 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1086 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
1052 : super("Redirect limit exceeded", redirects); | 1087 : super("Redirect limit exceeded", redirects); |
1053 } | 1088 } |
1054 | 1089 |
1055 | 1090 |
1056 class RedirectLoopException extends RedirectException { | 1091 class RedirectLoopException extends RedirectException { |
1057 const RedirectLoopException(List<RedirectInfo> redirects) | 1092 const RedirectLoopException(List<RedirectInfo> redirects) |
1058 : super("Redirect loop detected", redirects); | 1093 : super("Redirect loop detected", redirects); |
1059 } | 1094 } |
OLD | NEW |