| 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 interface HttpStatus { | 8 interface HttpStatus { |
| 9 static final int CONTINUE = 100; | 9 static final int CONTINUE = 100; |
| 10 static final int SWITCHING_PROTOCOLS = 101; | 10 static final int SWITCHING_PROTOCOLS = 101; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * HTTP response to be send back to the client. | 149 * HTTP response to be send back to the client. |
| 150 */ | 150 */ |
| 151 interface HttpResponse default _HttpResponse { | 151 interface HttpResponse default _HttpResponse { |
| 152 /** | 152 /** |
| 153 * Gets and sets the content length of the response. If the size of | 153 * Gets and sets the content length of the response. If the size of |
| 154 * the response is not known in advance set the content length to | 154 * the response is not known in advance set the content length to |
| 155 * -1 - which is also the default if not set. | 155 * -1 - which is also the default if not set. |
| 156 */ | 156 */ |
| 157 void set contentLength(int contentLength); | 157 int contentLength; |
| 158 int get contentLength(); | |
| 159 | 158 |
| 160 /** | 159 /** |
| 161 * Gets and sets the keep alive state of the connection. If the | 160 * Gets and sets the keep alive state of the connection. If the |
| 162 * associated request have a keep alive state of false setting keep | 161 * associated request have a keep alive state of false setting keep |
| 163 * alive to true will have no effect. | 162 * alive to true will have no effect. |
| 164 */ | 163 */ |
| 165 void set keepAlive(bool keepAlive); | 164 bool keepAlive; |
| 166 bool get keepAlive(); | 165 |
| 166 /** |
| 167 * Gets and sets the status code. Any integer value is accepted, but |
| 168 * for the official HTTP status codes use the fields from |
| 169 * [HttpStatus]. |
| 170 */ |
| 171 int statusCode; |
| 172 |
| 173 /** |
| 174 * Gets and sets the reason phrase. If no reason phrase is explicitly |
| 175 * set a default reason phrase is provided. |
| 176 */ |
| 177 String reasonPhrase; |
| 167 | 178 |
| 168 /** | 179 /** |
| 169 * Sets a header on the response. NOTE: If the same header name is | 180 * Sets a header on the response. NOTE: If the same header name is |
| 170 * set more than once only the last value will be part of the | 181 * set more than once only the last value will be part of the |
| 171 * response. | 182 * response. |
| 172 */ | 183 */ |
| 173 void setHeader(String name, String value); | 184 void setHeader(String name, String value); |
| 174 | 185 |
| 175 /** | 186 /** |
| 176 * Returns the output stream for the response. This is used to write | 187 * Returns the output stream for the response. This is used to write |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 268 |
| 258 /** | 269 /** |
| 259 * HTTP request for a client connection. | 270 * HTTP request for a client connection. |
| 260 */ | 271 */ |
| 261 interface HttpClientRequest default _HttpClientRequest { | 272 interface HttpClientRequest default _HttpClientRequest { |
| 262 /** | 273 /** |
| 263 * Gets and sets the content length of the request. If the size of | 274 * Gets and sets the content length of the request. If the size of |
| 264 * the request is not known in advance set content length to -1, | 275 * the request is not known in advance set content length to -1, |
| 265 * which is also the default. | 276 * which is also the default. |
| 266 */ | 277 */ |
| 267 void set contentLength(int contentLength); | 278 int contentLength; |
| 268 int get contentLength(); | |
| 269 | 279 |
| 270 /** | 280 /** |
| 271 * Gets and sets the keep alive state of the connection. | 281 * Gets and sets the keep alive state of the connection. |
| 272 */ | 282 */ |
| 273 void set keepAlive(bool keepAlive); | 283 bool keepAlive; |
| 274 bool get keepAlive(); | |
| 275 | 284 |
| 276 /** | 285 /** |
| 277 * Sets a header on the request. NOTE: If the same header name is | 286 * Sets a header on the request. NOTE: If the same header name is |
| 278 * set more than once only the last value set will be part of the | 287 * set more than once only the last value set will be part of the |
| 279 * request. | 288 * request. |
| 280 */ | 289 */ |
| 281 void setHeader(String name, String value); | 290 void setHeader(String name, String value); |
| 282 | 291 |
| 283 /** | 292 /** |
| 284 * Returns the output stream for the request. This is used to write | 293 * Returns the output stream for the request. This is used to write |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 */ | 346 */ |
| 338 InputStream get inputStream(); | 347 InputStream get inputStream(); |
| 339 } | 348 } |
| 340 | 349 |
| 341 | 350 |
| 342 class HttpException implements Exception { | 351 class HttpException implements Exception { |
| 343 const HttpException([String this.message = ""]); | 352 const HttpException([String this.message = ""]); |
| 344 String toString() => "HttpException: $message"; | 353 String toString() => "HttpException: $message"; |
| 345 final String message; | 354 final String message; |
| 346 } | 355 } |
| OLD | NEW |