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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 * Respond with a redirect to [location]. | 1167 * Respond with a redirect to [location]. |
1168 * | 1168 * |
1169 * The URI in [location] should be absolute, but there are no checks | 1169 * The URI in [location] should be absolute, but there are no checks |
1170 * to enforce that. | 1170 * to enforce that. |
1171 * | 1171 * |
1172 * By default the HTTP status code `HttpStatus.MOVED_TEMPORARILY` | 1172 * By default the HTTP status code `HttpStatus.MOVED_TEMPORARILY` |
1173 * (`302`) is used for the redirect, but an alternative one can be | 1173 * (`302`) is used for the redirect, but an alternative one can be |
1174 * specified using the [status] argument. | 1174 * specified using the [status] argument. |
1175 * | 1175 * |
1176 * This method will also call `close`, and the returned future is | 1176 * This method will also call `close`, and the returned future is |
1177 * the furure returned by `close`. | 1177 * the future returned by `close`. |
1178 */ | 1178 */ |
1179 Future redirect(Uri location, {int status: HttpStatus.MOVED_TEMPORARILY}); | 1179 Future redirect(Uri location, {int status: HttpStatus.MOVED_TEMPORARILY}); |
1180 | 1180 |
1181 /** | 1181 /** |
1182 * Detaches the underlying socket from the HTTP server. When the | 1182 * Detaches the underlying socket from the HTTP server. When the |
1183 * socket is detached the HTTP server will no longer perform any | 1183 * socket is detached the HTTP server will no longer perform any |
1184 * operations on it. | 1184 * operations on it. |
1185 * | 1185 * |
1186 * This is normally used when a HTTP upgrade request is received | 1186 * This is normally used when a HTTP upgrade request is received |
1187 * and the communication should continue with a different protocol. | 1187 * and the communication should continue with a different protocol. |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 /** | 1722 /** |
1723 * Set this property to [:true:] if this request should | 1723 * Set this property to [:true:] if this request should |
1724 * automatically follow redirects. The default is [:true:]. | 1724 * automatically follow redirects. The default is [:true:]. |
1725 * | 1725 * |
1726 * Automatic redirect will only happen for "GET" and "HEAD" requests | 1726 * Automatic redirect will only happen for "GET" and "HEAD" requests |
1727 * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] | 1727 * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:] |
1728 * (301), [:HttpStatus.FOUND:] (302), | 1728 * (301), [:HttpStatus.FOUND:] (302), |
1729 * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for | 1729 * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for |
1730 * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and | 1730 * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and |
1731 * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For | 1731 * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For |
1732 * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen | 1732 * [:HttpStatus.SEE_OTHER:] (303) automatic redirect will also happen |
1733 * for "POST" requests with the method changed to "GET" when | 1733 * for "POST" requests with the method changed to "GET" when |
1734 * following the redirect. | 1734 * following the redirect. |
1735 * | 1735 * |
1736 * All headers added to the request will be added to the redirection | 1736 * All headers added to the request will be added to the redirection |
1737 * request(s). However, any body send with the request will not be | 1737 * request(s). However, any body send with the request will not be |
1738 * part of the redirection request(s). | 1738 * part of the redirection request(s). |
1739 */ | 1739 */ |
1740 bool followRedirects; | 1740 bool followRedirects; |
1741 | 1741 |
1742 /** | 1742 /** |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 class RedirectException implements HttpException { | 2024 class RedirectException implements HttpException { |
2025 final String message; | 2025 final String message; |
2026 final List<RedirectInfo> redirects; | 2026 final List<RedirectInfo> redirects; |
2027 | 2027 |
2028 const RedirectException(this.message, this.redirects); | 2028 const RedirectException(this.message, this.redirects); |
2029 | 2029 |
2030 String toString() => "RedirectException: $message"; | 2030 String toString() => "RedirectException: $message"; |
2031 | 2031 |
2032 Uri get uri => redirects.last.location; | 2032 Uri get uri => redirects.last.location; |
2033 } | 2033 } |
OLD | NEW |