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

Side by Side Diff: tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate

Issue 24670002: Fixed more HttpRequest documentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * A utility for retrieving data from a URL. 8 * A utility for retrieving data from a URL.
9 * 9 *
10 * HttpRequest can be used to obtain data from http, ftp, and file 10 * HttpRequest can be used to obtain data from http, ftp, and file
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 */ 47 */
48 static Future<String> getString(String url, 48 static Future<String> getString(String url,
49 {bool withCredentials, void onProgress(ProgressEvent e)}) { 49 {bool withCredentials, void onProgress(ProgressEvent e)}) {
50 return request(url, withCredentials: withCredentials, 50 return request(url, withCredentials: withCredentials,
51 onProgress: onProgress).then((xhr) => xhr.responseText); 51 onProgress: onProgress).then((xhr) => xhr.responseText);
52 } 52 }
53 53
54 /** 54 /**
55 * Makes a server POST request with the specified data encoded as form data. 55 * Makes a server POST request with the specified data encoded as form data.
56 * 56 *
57 * This is similar to sending a FormData object with broader browser 57 * This is roughly the POST equivalent of getString. This method is similar
58 * support but limited to string values. 58 * to sending a FormData object with broader browser support but limited to
59 * String values.
59 * 60 *
60 * See also: 61 * See also:
61 * 62 *
62 * * [request] 63 * * [request]
63 */ 64 */
64 static Future<HttpRequest> postFormData(String url, Map<String, String> data, 65 static Future<HttpRequest> postFormData(String url, Map<String, String> data,
65 {bool withCredentials, String responseType, 66 {bool withCredentials, String responseType,
66 Map<String, String> requestHeaders, 67 Map<String, String> requestHeaders,
67 void onProgress(ProgressEvent e)}) { 68 void onProgress(ProgressEvent e)}) {
68 69
(...skipping 12 matching lines...) Expand all
81 82
82 return request(url, method: 'POST', withCredentials: withCredentials, 83 return request(url, method: 'POST', withCredentials: withCredentials,
83 responseType: responseType, 84 responseType: responseType,
84 requestHeaders: requestHeaders, sendData: formData, 85 requestHeaders: requestHeaders, sendData: formData,
85 onProgress: onProgress); 86 onProgress: onProgress);
86 } 87 }
87 88
88 /** 89 /**
89 * Creates a URL request for the specified [url]. 90 * Creates a URL request for the specified [url].
90 * 91 *
91 * By default this will do an HTTP GET request, this can be overridden with 92 * By default `request` will perform an HTTP GET request, but a different
92 * [method]. 93 * method (`POST`, `PUT`, `DELETE`, etc) can be used by specifying the
94 * [method] parameter.
93 * 95 *
94 * The Future is completed when the response is available. 96 * The Future is completed when the response is available.
95 * 97 *
98 * If specified, `sendData` will send data in the form of a [ByteBuffer],
99 * [Blob], [Document], [String], or [FormData] along with the HttpRequest.
100 *
96 * The [withCredentials] parameter specified that credentials such as a cookie 101 * The [withCredentials] parameter specified that credentials such as a cookie
97 * (already) set in the header or 102 * (already) set in the header or
98 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2) 103 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2)
99 * should be specified for the request. Details to keep in mind when using 104 * should be specified for the request. Details to keep in mind when using
100 * credentials: 105 * credentials:
101 * 106 *
102 * * Using credentials is only useful for cross-origin requests. 107 * * Using credentials is only useful for cross-origin requests.
103 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*). 108 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*).
104 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e. 109 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e.
105 * * If `Access-Control-Expose-Headers` has not been set to true, only a subse t of all the response headers will be returned when calling [getAllRequestHeader s]. 110 * * If `Access-Control-Expose-Headers` has not been set to true, only a subse t of all the response headers will be returned when calling [getAllRequestHeader s].
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } else { 267 } else {
263 JS('', '#.send()', xhr); 268 JS('', '#.send()', xhr);
264 } 269 }
265 270
266 return completer.future; 271 return completer.future;
267 $endif 272 $endif
268 } 273 }
269 274
270 $!MEMBERS 275 $!MEMBERS
271 } 276 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698