Index: sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate |
=================================================================== |
--- sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate (revision 15801) |
+++ sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate (working copy) |
@@ -4,11 +4,34 @@ |
part of html; |
-/// @domName $DOMNAME |
+/// HttpRequest is a utility for retrieving data from a URL. |
+/// |
+/// HttpRequest can be used to obtain data from http, ftp, as well as file |
+/// protocols. |
+/// |
+/// For example, suppose we're developing this Dart documentation page, and we |
+/// wish to retrieve the html of the top level page and print it out. |
+/// The easiest way to do that would be: |
+/// |
+/// var httpRequest = HttpRequest.get('http://api.dartlang.org', (request) => print(request.responseText)); |
+/// |
+/// It is important to note that with the default behavior of this class, your |
+/// code making the request should be served from the same origin (domain name, |
+/// port, and application layer protocol) as the url you are trying to access |
+/// with HttpRequest. However, there are ways to |
+/// [get around this restriction](http://www.dartlang.org/articles/json-web-service/#note-on-jsonp). |
+/// |
+/// See also: |
+/// [Dart article on using HttpRequests](http://www.dartlang.org/articles/json-web-service/#getting-data), |
+/// [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest), |
+/// and [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest) |
+/// @domName $DOMNAME; @docsEditable true |
class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
+ /// @docsEditable true |
factory $CLASSNAME.get(String url, onComplete($CLASSNAME request)) => |
_$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_get(url, onComplete); |
+ /// @docsEditable true |
factory $CLASSNAME.getWithCredentials(String url, |
onComplete($CLASSNAME request)) => |
_$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_getWithCredentials(url, |