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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 /** | 710 /** |
| 711 * Sets the handler that gets called if an error occurs while | 711 * Sets the handler that gets called if an error occurs while |
| 712 * connecting or processing the HTTP request. | 712 * connecting or processing the HTTP request. |
| 713 */ | 713 */ |
| 714 void set onError(void callback(e)); | 714 void set onError(void callback(e)); |
| 715 | 715 |
| 716 /** | 716 /** |
| 717 * Set this property to [:true:] if this connection should | 717 * Set this property to [:true:] if this connection should |
| 718 * automatically follow redirects. The default is [:true:]. | 718 * automatically follow redirects. The default is [:true:]. |
| 719 */ | 719 */ |
| 720 bool followRedirect; | 720 bool followRedirects; |
| 721 | 721 |
| 722 /** | 722 /** |
| 723 * Set this property to the maximum number of redirects to follow | 723 * Set this property to the maximum number of redirects to follow |
| 724 * when [followRedirect] is [:true:]. If this number is exceeded the | 724 * when [followRedirects] is [:true:]. If this number is exceeded the |
| 725 * [onError] callback will be called with a [RedirectLimitExceeded] | 725 * [onError] callback will be called with a [RedirectLimitExceeded] |
| 726 * exception. The default value is 5. | 726 * exception. The default value is 5. |
| 727 */ | 727 */ |
| 728 int maxRedirects; | 728 int maxRedirects; |
| 729 | 729 |
| 730 /** | 730 /** |
| 731 * Returns the series of redirects this connection has been through. | 731 * Returns the series of redirects this connection has been through. |
| 732 */ | 732 */ |
| 733 List<RedirectInfo> get redirects(); | 733 List<RedirectInfo> get redirects(); |
| 734 | 734 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 * Returns the request headers. | 768 * Returns the request headers. |
| 769 */ | 769 */ |
| 770 HttpHeaders get headers(); | 770 HttpHeaders get headers(); |
| 771 | 771 |
| 772 /** | 772 /** |
| 773 * Cookies to present to the server (in the Cookie header). | 773 * Cookies to present to the server (in the Cookie header). |
| 774 */ | 774 */ |
| 775 List<Cookie> get cookies(); | 775 List<Cookie> get cookies(); |
| 776 | 776 |
| 777 /** | 777 /** |
| 778 * Sets the requested persistent connection state. | |
|
Søren Gjesse
2012/06/11 13:19:06
Sets -> Gets and sets
We should not mention HTTP
| |
| 779 * The default value is the default for the protocol: | |
| 780 * true for HTTP 1.1, false for HTTP 1.0. | |
| 781 */ | |
| 782 bool persistentConnection; | |
| 783 | |
| 784 /** | |
| 778 * Returns the output stream for the request. This is used to write | 785 * Returns the output stream for the request. This is used to write |
| 779 * the request data. When all request data has been written close | 786 * the request data. When all request data has been written close |
| 780 * the stream to indicate the end of the request. | 787 * the stream to indicate the end of the request. |
| 781 * | 788 * |
| 782 * When this is accessed for the first time the request header is | 789 * When this is accessed for the first time the request header is |
| 783 * send. Calling any methods that will change the header after | 790 * send. Calling any methods that will change the header after |
| 784 * having retrieved the output stream will throw an exception. | 791 * having retrieved the output stream will throw an exception. |
| 785 */ | 792 */ |
| 786 OutputStream get outputStream(); | 793 OutputStream get outputStream(); |
| 787 } | 794 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 801 */ | 808 */ |
| 802 String get reasonPhrase(); | 809 String get reasonPhrase(); |
| 803 | 810 |
| 804 /** | 811 /** |
| 805 * Returns the content length of the request body. If the size of | 812 * Returns the content length of the request body. If the size of |
| 806 * the request body is not known in advance this -1. | 813 * the request body is not known in advance this -1. |
| 807 */ | 814 */ |
| 808 int get contentLength(); | 815 int get contentLength(); |
| 809 | 816 |
| 810 /** | 817 /** |
| 818 * Gets the persistent connection state returned by the server. | |
|
Søren Gjesse
2012/06/11 13:19:06
I think we should make this a getter. I know the i
| |
| 819 */ | |
| 820 bool persistentConnection; | |
| 821 | |
| 822 /** | |
| 811 * Returns whether the status code is one of the normal redirect | 823 * Returns whether the status code is one of the normal redirect |
| 812 * codes [:HttpStatus.MOVED_PERMANENTLY:], [:HttpStatus.FOUND:], | 824 * codes [:HttpStatus.MOVED_PERMANENTLY:], [:HttpStatus.FOUND:], |
| 813 * [:HttpStatus.MOVED_TEMPORARILY:], [:HttpStatus.SEE_OTHER:] and | 825 * [:HttpStatus.MOVED_TEMPORARILY:], [:HttpStatus.SEE_OTHER:] and |
| 814 * [:HttpStatus.TEMPORARY_REDIRECT:]. | 826 * [:HttpStatus.TEMPORARY_REDIRECT:]. |
| 815 */ | 827 */ |
| 816 bool get isRedirect(); | 828 bool get isRedirect(); |
| 817 | 829 |
| 818 /** | 830 /** |
| 819 * Returns the response headers. | 831 * Returns the response headers. |
| 820 */ | 832 */ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 class RedirectLimitExceededException extends RedirectException { | 896 class RedirectLimitExceededException extends RedirectException { |
| 885 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 897 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
| 886 : super("Redirect limit exceeded", redirects); | 898 : super("Redirect limit exceeded", redirects); |
| 887 } | 899 } |
| 888 | 900 |
| 889 | 901 |
| 890 class RedirectLoopException extends RedirectException { | 902 class RedirectLoopException extends RedirectException { |
| 891 const RedirectLoopException(List<RedirectInfo> redirects) | 903 const RedirectLoopException(List<RedirectInfo> redirects) |
| 892 : super("Redirect loop detected", redirects); | 904 : super("Redirect loop detected", redirects); |
| 893 } | 905 } |
| OLD | NEW |