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

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

Issue 11962049: Revert "Fixing formatting of dart:html's dart2js annotations." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
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 html; 5 part of html;
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
11 * protocols. 11 * protocols.
12 * 12 *
13 * For example, suppose we're developing these API docs, and we 13 * For example, suppose we're developing these API docs, and we
14 * wish to retrieve the HTML of the top-level page and print it out. 14 * wish to retrieve the HTML of the top-level page and print it out.
15 * The easiest way to do that would be: 15 * The easiest way to do that would be:
16 * 16 *
17 * var httpRequest = HttpRequest.get('http://api.dartlang.org', 17 * var httpRequest = HttpRequest.get('http://api.dartlang.org',
18 * (request) => print(request.responseText)); 18 * (request) => print(request.responseText));
19 * 19 *
20 * **Important**: With the default behavior of this class, your 20 * **Important**: With the default behavior of this class, your
21 * code making the request should be served from the same origin (domain name, 21 * code making the request should be served from the same origin (domain name,
22 * port, and application layer protocol) as the URL you are trying to access 22 * port, and application layer protocol) as the URL you are trying to access
23 * with HttpRequest. However, there are ways to 23 * with HttpRequest. However, there are ways to
24 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp). 24 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp).
25 * 25 *
26 * See also: 26 * See also:
27 * 27 *
28 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data) 28 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data)
29 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq uest) 29 * * [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpReq uest)
30 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp Request/Using_XMLHttpRequest) 30 * * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttp Request/Using_XMLHttpRequest)
31 */ 31 */
32 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 32 @DomName('XMLHttpRequest')
33 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
33 /** 34 /**
34 * Creates a URL get request for the specified `url`. 35 * Creates a URL get request for the specified `url`.
35 * 36 *
36 * After completing the request, the object will call the user-provided 37 * After completing the request, the object will call the user-provided
37 * [onComplete] callback. 38 * [onComplete] callback.
38 */ 39 */
39 factory $CLASSNAME.get(String url, onComplete($CLASSNAME request)) => 40 factory $CLASSNAME.get(String url, onComplete($CLASSNAME request)) =>
40 _HttpRequestUtils.get(url, onComplete, false); 41 _HttpRequestUtils.get(url, onComplete, false);
41 42
42 // 80 char issue for comments in lists: dartbug.com/7588. 43 // 80 char issue for comments in lists: dartbug.com/7588.
43 /** 44 /**
44 * Creates a URL GET request for the specified `url` with 45 * Creates a URL GET request for the specified `url` with
45 * credentials such a cookie (already) set in the header or 46 * credentials such a cookie (already) set in the header or
46 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2). 47 * [authorization headers](http://tools.ietf.org/html/rfc1945#section-10.2).
47 * 48 *
48 * After completing the request, the object will call the user-provided 49 * After completing the request, the object will call the user-provided
49 * [onComplete] callback. 50 * [onComplete] callback.
50 * 51 *
51 * A few other details to keep in mind when using credentials: 52 * A few other details to keep in mind when using credentials:
52 * 53 *
53 * * Using credentials is only useful for cross-origin requests. 54 * * Using credentials is only useful for cross-origin requests.
54 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*). 55 * * The `Access-Control-Allow-Origin` header of `url` cannot contain a wildca rd (*).
55 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e. 56 * * The `Access-Control-Allow-Credentials` header of `url` must be set to tru e.
56 * * 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]. 57 * * 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].
57 * 58 *
58 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access _authentication). 59 * See also: [authorization headers](http://en.wikipedia.org/wiki/Basic_access _authentication).
59 */ 60 */
60 factory $CLASSNAME.getWithCredentials(String url, 61 factory $CLASSNAME.getWithCredentials(String url,
61 onComplete($CLASSNAME request)) => 62 onComplete($CLASSNAME request)) =>
62 _HttpRequestUtils.get(url, onComplete, true); 63 _HttpRequestUtils.get(url, onComplete, true);
63 64
64 $!MEMBERS 65 $!MEMBERS
65 } 66 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_WheelEvent.darttemplate ('k') | tools/dom/templates/html/impl/pure_interface.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698