Chromium Code Reviews| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 * Gets and sets the host part of the "Host" header for the | 292 * Gets and sets the host part of the "Host" header for the |
| 293 * connection. | 293 * connection. |
| 294 */ | 294 */ |
| 295 String host; | 295 String host; |
| 296 | 296 |
| 297 /** | 297 /** |
| 298 * Gets and sets the port part of the "Host" header for the | 298 * Gets and sets the port part of the "Host" header for the |
| 299 * connection. | 299 * connection. |
| 300 */ | 300 */ |
| 301 int port; | 301 int port; |
| 302 | |
| 303 /** | |
| 304 * Gets and sets the content type. | |
| 305 */ | |
| 306 ContentType contentType; | |
|
Anders Johnsen
2012/05/21 07:37:30
IMO, this is a good way of exposing this.
Søren Gjesse
2012/05/21 11:11:06
Thanks!
| |
| 302 } | 307 } |
| 303 | 308 |
| 304 | 309 |
| 310 /** | |
| 311 * Representation of a header value in the form: | |
| 312 * | |
| 313 * [:value; parameter1=value1; parameter2=value2:] | |
| 314 */ | |
| 315 interface HeaderValue default _HeaderValue { | |
|
Anders Johnsen
2012/05/21 07:37:30
The name HeaderValue confuses me. It sounds as it
Mads Ager (google)
2012/05/21 07:40:39
Should we expose this interface? At this point onl
Søren Gjesse
2012/05/21 11:11:06
ContentType extend HeaderValue. It should be possi
Søren Gjesse
2012/05/21 11:11:06
Currently this interface is extended by ContentTyp
| |
| 316 /** | |
| 317 * Creates a new header value object setting the value. | |
| 318 */ | |
| 319 HeaderValue([String value]); | |
| 320 | |
| 321 /** | |
| 322 * Creates a new header value object from parsing a header value. | |
|
Mads Ager (google)
2012/05/21 07:40:39
What is the format of the input string? Does it co
Søren Gjesse
2012/05/21 11:11:06
Added example to interface description.
| |
| 323 */ | |
| 324 HeaderValue.fromString(String value); | |
| 325 | |
| 326 /** | |
| 327 * Gets and sets the header value. | |
| 328 */ | |
| 329 String value; | |
|
Anders Johnsen
2012/05/21 07:37:30
Have a toString that maps to the full content?
Søren Gjesse
2012/05/21 11:11:06
toString was already there. Documentation added.
| |
| 330 | |
| 331 /** | |
| 332 * Gets the map of parameters. | |
| 333 */ | |
| 334 Map<String, String> get parameters(); | |
| 335 } | |
| 336 | |
| 337 | |
| 338 /** | |
| 339 * Representation of a content type. | |
| 340 */ | |
| 341 interface ContentType extends HeaderValue default _ContentType { | |
|
Anders Johnsen
2012/05/21 07:37:30
Here, I think we should have a toString as well.
Søren Gjesse
2012/05/21 11:11:06
toString is now documented in the HeaderValue inte
| |
| 342 /** | |
| 343 * Creates a new content type object setting the primary type and | |
| 344 * sub type. If either is not passed their values will be the empty | |
| 345 * string. | |
| 346 */ | |
| 347 ContentType([String primaryType, String subType]); | |
| 348 | |
| 349 /** | |
| 350 * Creates a new content type object from parsing a Content-Type | |
| 351 * header value. As primary type, sub type and parameter names and | |
|
Mads Ager (google)
2012/05/21 07:40:39
Maybe give a concrete example of a Content-Type he
Søren Gjesse
2012/05/21 11:11:06
Done.
| |
| 352 * values are not case sensitive all these values will be converted | |
| 353 * to lower case. | |
| 354 */ | |
| 355 ContentType.fromString(String value); | |
| 356 | |
| 357 /** | |
| 358 * Gets and sets the content type in the form "primaryType/subType". | |
| 359 */ | |
| 360 String value; | |
| 361 | |
| 362 /** | |
| 363 * Gets and sets the primary type. | |
| 364 */ | |
| 365 String primaryType; | |
| 366 | |
| 367 /** | |
| 368 * Gets and sets the sub type. | |
| 369 */ | |
| 370 String subType; | |
| 371 | |
| 372 /** | |
| 373 * Gets and sets the character set. | |
|
Mads Ager (google)
2012/05/21 07:40:39
Can we specify the valid values in the interface?
Søren Gjesse
2012/05/21 11:11:06
This is not really possible.
| |
| 374 */ | |
| 375 String charset; | |
| 376 } | |
| 377 | |
| 378 | |
| 305 /** | 379 /** |
| 306 * Http request delivered to the HTTP server callback. | 380 * Http request delivered to the HTTP server callback. |
| 307 */ | 381 */ |
| 308 interface HttpRequest default _HttpRequest { | 382 interface HttpRequest default _HttpRequest { |
| 309 /** | 383 /** |
| 310 * Returns the content length of the request body. If the size of | 384 * Returns the content length of the request body. If the size of |
| 311 * the request body is not known in advance this -1. | 385 * the request body is not known in advance this -1. |
| 312 */ | 386 */ |
| 313 int get contentLength(); | 387 int get contentLength(); |
| 314 | 388 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 class RedirectLimitExceededException extends RedirectException { | 746 class RedirectLimitExceededException extends RedirectException { |
| 673 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 747 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
| 674 : super("Redirect limit exceeded", redirects); | 748 : super("Redirect limit exceeded", redirects); |
| 675 } | 749 } |
| 676 | 750 |
| 677 | 751 |
| 678 class RedirectLoopException extends RedirectException { | 752 class RedirectLoopException extends RedirectException { |
| 679 const RedirectLoopException(List<RedirectInfo> redirects) | 753 const RedirectLoopException(List<RedirectInfo> redirects) |
| 680 : super("Redirect loop detected", redirects); | 754 : super("Redirect loop detected", redirects); |
| 681 } | 755 } |
| OLD | NEW |