Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: sdk/lib/io/http.dart

Issue 21411003: Add redirect method to HttpResponse (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | sdk/lib/io/http_impl.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 * Returns the response headers. 838 * Returns the response headers.
839 */ 839 */
840 HttpHeaders get headers; 840 HttpHeaders get headers;
841 841
842 /** 842 /**
843 * Cookies to set in the client (in the 'set-cookie' header). 843 * Cookies to set in the client (in the 'set-cookie' header).
844 */ 844 */
845 List<Cookie> get cookies; 845 List<Cookie> get cookies;
846 846
847 /** 847 /**
848 * Send a redirect to [location] to the client.
Anders Johnsen 2013/08/02 08:22:03 "to the client." may be redundant.
Søren Gjesse 2013/08/02 09:01:06 Done.
849 *
850 * The [location] argument can be either a [Uri] or a [String]. If
851 * it is a [String] it is turned into a [Uri] using [Uri.parse].
852 *
853 * The redirect response will always have an absolute URI in the
854 * `Location` header. If the URI passed in [location] is relative it
855 * will be turned into an absolute URI by resolving it against the
856 * URI of the current request and the address and port of the
857 * server.
858 *
859 * By default the HTTP status code `302` is used for the redirect,
860 * but an alternative one can be specified using the [status]
861 * argument.
862 *
863 * This method will also call `close`, and the returned future is
864 * the furure returned by `close`.
865 */
866 Future redirect(location, [int status = HttpStatus.MOVED_TEMPORARILY]);
Anders Johnsen 2013/08/02 08:22:03 I think it should be a named argument.
Søren Gjesse 2013/08/02 09:01:06 Done.
867
868 /**
848 * Detaches the underlying socket from the HTTP server. When the 869 * Detaches the underlying socket from the HTTP server. When the
849 * socket is detached the HTTP server will no longer perform any 870 * socket is detached the HTTP server will no longer perform any
850 * operations on it. 871 * operations on it.
851 * 872 *
852 * This is normally used when a HTTP upgrade request is received 873 * This is normally used when a HTTP upgrade request is received
853 * and the communication should continue with a different protocol. 874 * and the communication should continue with a different protocol.
854 */ 875 */
855 Future<Socket> detachSocket(); 876 Future<Socket> detachSocket();
856 877
857 /** 878 /**
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1489
1469 class RedirectException implements HttpException { 1490 class RedirectException implements HttpException {
1470 final String message; 1491 final String message;
1471 final List<RedirectInfo> redirects; 1492 final List<RedirectInfo> redirects;
1472 1493
1473 const RedirectException(String this.message, 1494 const RedirectException(String this.message,
1474 List<RedirectInfo> this.redirects); 1495 List<RedirectInfo> this.redirects);
1475 1496
1476 String toString() => "RedirectException: $message"; 1497 String toString() => "RedirectException: $message";
1477 } 1498 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | sdk/lib/io/http_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698