Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * HTTP status codes. | 8 * HTTP status codes. |
| 9 */ | 9 */ |
| 10 abstract class HttpStatus { | 10 abstract class HttpStatus { |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 /** | 669 /** |
| 670 * Gets the [HttpResponse] object, used for sending back the response to the | 670 * Gets the [HttpResponse] object, used for sending back the response to the |
| 671 * client. | 671 * client. |
| 672 */ | 672 */ |
| 673 HttpResponse get response; | 673 HttpResponse get response; |
| 674 } | 674 } |
| 675 | 675 |
| 676 | 676 |
| 677 /** | 677 /** |
| 678 * HTTP response to be send back to the client. | 678 * HTTP response to be send back to the client. |
| 679 * | |
| 680 * This object has a number of properties for setting up the HTTP | |
| 681 * header of the response. Then the header has been set up the methods | |
|
Anders Johnsen
2013/03/07 16:53:49
Then -> When ?
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 682 * from the [IOSink] can be used to write the actual body of the HTTP | |
| 683 * response. When one of the [IOSink] methods this is used for the | |
|
Anders Johnsen
2013/03/07 16:53:49
Remove 'this'.
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 684 * first time the request header is send. Calling any methods that | |
| 685 * will change the header after it is sent will throw an exception. | |
| 686 * | |
| 687 * When writing string data through the [IOSink] the encoding used | |
| 688 * will be determined from the "charset" parameter of the | |
| 689 * "Content-Type" header. | |
| 690 * | |
| 691 * HttpResponse response = ... | |
| 692 * response.headers.contentType | |
| 693 * = new ContentType("application", "json", charset: "utf-8"); | |
| 694 * response.write(...); // Strings written will be UTF-8 encoded. | |
| 695 * | |
| 696 * If no charset is provided the default of ISO-8859-1 (Latin 1) will | |
| 697 * be used. | |
| 698 * | |
| 699 * HttpResponse response = ... | |
| 700 * response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); | |
| 701 * response.write(...); // Strings written will be ISO-8859-1 encoded. | |
| 702 * | |
| 703 * If an unsupported encoding is used an exception will be thrown. | |
|
nweiz
2013/03/07 19:32:05
Specify that the exception will only be thrown whe
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 679 */ | 704 */ |
| 680 abstract class HttpResponse implements IOSink<HttpResponse> { | 705 abstract class HttpResponse implements IOSink<HttpResponse> { |
| 681 // TODO(ajohnsen): Add documentation of how to pipe a file to the response. | 706 // TODO(ajohnsen): Add documentation of how to pipe a file to the response. |
| 682 /** | 707 /** |
| 683 * Gets and sets the content length of the response. If the size of | 708 * Gets and sets the content length of the response. If the size of |
| 684 * the response is not known in advance set the content length to | 709 * the response is not known in advance set the content length to |
| 685 * -1 - which is also the default if not set. | 710 * -1 - which is also the default if not set. |
| 686 */ | 711 */ |
| 687 int contentLength; | 712 int contentLength; |
| 688 | 713 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 * trying to establish a new connection after calling [shutdown] | 878 * trying to establish a new connection after calling [shutdown] |
| 854 * will throw an exception. | 879 * will throw an exception. |
| 855 */ | 880 */ |
| 856 void close({bool force: false}); | 881 void close({bool force: false}); |
| 857 } | 882 } |
| 858 | 883 |
| 859 | 884 |
| 860 /** | 885 /** |
| 861 * HTTP request for a client connection. | 886 * HTTP request for a client connection. |
| 862 * | 887 * |
| 863 * The request is an [IOSink], used to write the request data. When | 888 * This object has a number of properties for setting up the HTTP |
| 864 * all request data has been written, close the stream to indicate the end of | 889 * header of the request. Then the header has been set up the methods |
|
Anders Johnsen
2013/03/07 16:53:49
Then -> When
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 865 * the request. | 890 * from the [IOSink] can be used to write the actual body of the HTTP |
| 891 * request. When one of the [IOSink] methods this is used for the | |
|
Anders Johnsen
2013/03/07 16:53:49
Remove 'this'.
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 892 * first time the request header is send. Calling any methods that | |
| 893 * will change the header after it is sent will throw an exception. | |
| 866 * | 894 * |
| 867 * When this is accessed for the first time the request header is | 895 * When writing string data through the [IOSink] the |
| 868 * send. Calling any methods that will change the header after | 896 * encoding used will be determined from the "charset" parameter of |
| 869 * having retrieved the output stream will throw an exception. | 897 * the "Content-Type" header. |
| 898 * | |
| 899 * HttpClientRequest request = ... | |
| 900 * request.headers.contentType | |
| 901 * = new ContentType("application", "json", charset: "utf-8"); | |
| 902 * request.write(...); // Strings written will be UTF-8 encoded. | |
| 903 * | |
| 904 * If no charset is provided the default of ISO-8859-1 (Latin 1) will | |
| 905 * be used. | |
| 906 * | |
| 907 * HttpClientRequest request = ... | |
| 908 * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); | |
| 909 * request.write(...); // Strings written will be ISO-8859-1 encoded. | |
| 910 * | |
| 911 * If an unsupported encoding is used an exception will be thrown. | |
|
nweiz
2013/03/07 19:32:05
Also here.
Søren Gjesse
2013/03/08 09:47:46
Done.
| |
| 870 */ | 912 */ |
| 871 abstract class HttpClientRequest | 913 abstract class HttpClientRequest |
| 872 implements IOSink<HttpClientRequest> { | 914 implements IOSink<HttpClientRequest> { |
| 873 /** | 915 /** |
| 874 * Gets and sets the content length of the request. If the size of | 916 * Gets and sets the content length of the request. If the size of |
| 875 * the request is not known in advance set content length to -1, | 917 * the request is not known in advance set content length to -1, |
| 876 * which is also the default. | 918 * which is also the default. |
| 877 */ | 919 */ |
| 878 int contentLength; | 920 int contentLength; |
| 879 | 921 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1121 class RedirectLimitExceededException extends RedirectException { | 1163 class RedirectLimitExceededException extends RedirectException { |
| 1122 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1164 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
| 1123 : super("Redirect limit exceeded", redirects); | 1165 : super("Redirect limit exceeded", redirects); |
| 1124 } | 1166 } |
| 1125 | 1167 |
| 1126 | 1168 |
| 1127 class RedirectLoopException extends RedirectException { | 1169 class RedirectLoopException extends RedirectException { |
| 1128 const RedirectLoopException(List<RedirectInfo> redirects) | 1170 const RedirectLoopException(List<RedirectInfo> redirects) |
| 1129 : super("Redirect loop detected", redirects); | 1171 : super("Redirect loop detected", redirects); |
| 1130 } | 1172 } |
| OLD | NEW |