Revision: 7543
Author: gwt.mirror...@gmail.com
Date: Wed Feb 10 08:14:42 2010
Log: HTTPRequest has been deprecated since GWT 1.5 in exchange for
RequestBuilder. This patch removes it completely.
http://gwt-code-reviews.appspot.com/139804/show
http://code.google.com/p/google-web-toolkit/source/detail?r=7543
Deleted:
/trunk/user/src/com/google/gwt/user/client/HTTPRequest.java
/trunk/user/src/com/google/gwt/user/client/impl/HTTPRequestImpl.java
/trunk/user/test/com/google/gwt/http/client/HTTPRequestTest.java
Modified:
/trunk/tools/api-checker/config/gwt20_21userApi.conf
/trunk/user/test/com/google/gwt/http/HTTPSuite.java
=======================================
--- /trunk/user/src/com/google/gwt/user/client/HTTPRequest.java Fri Oct 16
14:48:33 2009
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
- * use this file except in compliance with the License. You may obtain a
copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
under
- * the License.
- */
-package com.google.gwt.user.client;
-
-/**
- * This class allows you to make asynchronous HTTP requests to the
originating
- * server.
- *
- * @deprecated As of GWT 1.5, replaced by
- * {...@link com.google.gwt.http.client.RequestBuilder
RequestBuilder}.
- */
-...@deprecated
-public class HTTPRequest {
-
- /**
- * Makes an asynchronous HTTP GET to a remote server.
- *
- * @param url the absolute url to GET
- * @param handler the response handler to be notified when either the
request
- * fails, or is completed successfully
- * @return <code>false</code> if the invocation fails to issue
- */
- public static boolean asyncGet(String url, ResponseTextHandler handler) {
- return asyncGetImpl(null, null, url, handler);
- }
-
- /**
- * Makes an asynchronous HTTP GET to a remote server.
- *
- * @param url the absolute url to GET
- * @param handler the response handler to be notified when either the
request
- * fails, or is completed successfully
- * @return <code>false</code> if the invocation fails to issue
- */
- public static boolean asyncGet(String user, String pwd, String url,
- ResponseTextHandler handler) {
- return asyncGetImpl(user, pwd, url, handler);
- }
-
- /**
- * Makes an asynchronous HTTP POST to a remote server.
- *
- * @param url the absolute url to which the POST data is delivered
- * @param postData the data to post
- * @param handler the response handler to be notified when either the
request
- * fails, or is completed successfully
- * @return <code>false</code> if the invocation fails to issue
- */
- public static boolean asyncPost(String url, String postData,
- ResponseTextHandler handler) {
- return asyncPostImpl(null, null, url, postData, handler);
- }
-
- /**
- * Makes an asynchronous HTTP POST to a remote server.
- *
- * @param url the absolute url to which the POST data is delivered
- * @param postData the data to post
- * @param handler the response handler to be notified when either the
request
- * fails, or is completed successfully
- * @return <code>false</code> if the invocation fails to issue
- */
- public static boolean asyncPost(String user, String pwd, String url,
- String postData, ResponseTextHandler handler) {
- return asyncPostImpl(user, pwd, url, postData, handler);
- }
-
- private static native boolean asyncGetImpl(String user, String pwd,
String url,
- ResponseTextHandler handler) /*-{
- var xmlHttp = @com.google.gwt.xhr.client.XMLHttpRequest::create()();
- try {
- xmlHttp.open("GET", url, true);
- xmlHttp.setRequestHeader("Content-Type", "text/plain;
charset=utf-8");
- xmlHttp.onreadystatechange = $entry(function() {
- if (xmlHttp.readyState == 4) {
- $wnd.setTimeout(function() {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- }, 0);
-
handl...@com.google.gwt.user.client.responsetexthandler::onCompletion(Ljava/lang/String;)(xmlHttp.responseText
|| "");
- }
- });
- xmlHttp.send('');
- return true;
- } catch (e) {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- return false;
- }
- }-*/;
-
- private static native boolean asyncPostImpl(String user, String pwd,
String url,
- String postData, ResponseTextHandler handler) /*-{
- var xmlHttp = @com.google.gwt.xhr.client.XMLHttpRequest::create()();
- try {
- xmlHttp.open("POST", url, true);
- xmlHttp.setRequestHeader("Content-Type", "text/plain;
charset=utf-8");
- xmlHttp.onreadystatechange = $entry(function() {
- if (xmlHttp.readyState == 4) {
- $wnd.setTimeout(function() {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- }, 0);
-
handl...@com.google.gwt.user.client.responsetexthandler::onCompletion(Ljava/lang/String;)(xmlHttp.responseText
|| "");
- }
- });
- xmlHttp.send(postData);
- return true;
- }
- catch (e) {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- return false;
- }
- }-*/;
-}
=======================================
--- /trunk/user/src/com/google/gwt/user/client/impl/HTTPRequestImpl.java
Fri Oct 16 14:48:33 2009
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2006 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
- * use this file except in compliance with the License. You may obtain a
copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
under
- * the License.
- */
-package com.google.gwt.user.client.impl;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.ResponseTextHandler;
-
-/**
- * Native implementation associated with
- * {...@link com.google.gwt.user.client.HTTPRequest}.
- */
-public class HTTPRequestImpl {
-
- static JavaScriptObject nullFunc;
-
- public HTTPRequestImpl() {
- // TODO - consider moving this to clinit or creating it on the fly
rather
- // than assigning it to a static
- nullFunc = JavaScriptObject.createFunction();
- }
-
- public boolean asyncGet(String url, ResponseTextHandler handler) {
- return asyncGet(null, null, url, handler);
- }
-
- public boolean asyncGet(String user, String pwd, String url,
- ResponseTextHandler handler) {
- return asyncGetImpl(user, pwd, url, handler);
- }
-
- public boolean asyncPost(String url, String postData,
- ResponseTextHandler handler) {
- return asyncPost(null, null, url, postData, handler);
- }
-
- public boolean asyncPost(String user, String pwd, String url,
- String postData, ResponseTextHandler handler) {
- return asyncPostImpl(user, pwd, url, postData, handler);
- }
-
- public JavaScriptObject createXmlHTTPRequest() {
- return doCreateXmlHTTPRequest();
- }
-
- /**
- * All the supported browsers except for IE instantiate it as shown.
- */
- protected native JavaScriptObject doCreateXmlHTTPRequest() /*-{
- return new XMLHttpRequest();
- }-*/;
-
- private native boolean asyncGetImpl(String user, String pwd, String url,
- ResponseTextHandler handler) /*-{
- var xmlHttp =
th...@com.google.gwt.user.client.impl.httprequestimpl::doCreateXmlHTTPRequest()();
- try {
- xmlHttp.open("GET", url, true);
- xmlHttp.setRequestHeader("Content-Type", "text/plain;
charset=utf-8");
- xmlHttp.onreadystatechange = $entry(function() {
- if (xmlHttp.readyState == 4) {
- $wnd.setTimeout($entry(function() {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- }), 0);
-
handl...@com.google.gwt.user.client.responsetexthandler::onCompletion(Ljava/lang/String;)(xmlHttp.responseText
|| "");
- }
- });
- xmlHttp.send('');
- return true;
- } catch (e) {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- return false;
- }
- }-*/;
-
- private native boolean asyncPostImpl(String user, String pwd, String url,
- String postData, ResponseTextHandler handler) /*-{
- var xmlHttp =
th...@com.google.gwt.user.client.impl.httprequestimpl::doCreateXmlHTTPRequest()();
- try {
- xmlHttp.open("POST", url, true);
- xmlHttp.setRequestHeader("Content-Type", "text/plain;
charset=utf-8");
- xmlHttp.onreadystatechange = $entry(function() {
- if (xmlHttp.readyState == 4) {
- $wnd.setTimeout($entry(function() {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- }), 0);
-
handl...@com.google.gwt.user.client.responsetexthandler::onCompletion(Ljava/lang/String;)(xmlHttp.responseText
|| "");
- }
- });
- xmlHttp.send(postData);
- return true;
- }
- catch (e) {
- xmlHttp.onreadystatechange =
@com.google.gwt.user.client.impl.HTTPRequestImpl::nullFunc;
- return false;
- }
- }-*/;
-}
=======================================
--- /trunk/user/test/com/google/gwt/http/client/HTTPRequestTest.java Tue
Nov 10 10:55:44 2009
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
- * use this file except in compliance with the License. You may obtain a
copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
under
- * the License.
- */
-package com.google.gwt.http.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.HTTPRequest;
-import com.google.gwt.user.client.ResponseTextHandler;
-
-/**
- * Test cases for the {...@link HTTPRequest} class.
- *
- */
-...@deprecated
-public class HTTPRequestTest extends RequestTestBase {
-
- private static String getTestBaseURL() {
- return GWT.getModuleBaseURL() + "testRequestBuilder/";
- }
-
- @Override
- public String getModuleName() {
- return "com.google.gwt.http.RequestBuilderTest";
- }
-
- public void testAsyncGet() {
- delayTestFinishForRequest();
- HTTPRequest.asyncGet(getTestBaseURL() + "send_GET",
- new ResponseTextHandler() {
- public void onCompletion(String responseText) {
- assertEquals(RequestBuilderTest.SERVLET_GET_RESPONSE,
responseText);
- finishTest();
- }
- });
- }
-
- public void testAsyncPost() {
- delayTestFinishForRequest();
- HTTPRequest.asyncPost(getTestBaseURL() + "simplePost",
- "method=test+request", new ResponseTextHandler() {
- public void onCompletion(String responseText) {
- assertEquals(RequestBuilderTest.SERVLET_POST_RESPONSE,
responseText);
- finishTest();
- }
- });
- }
-}
=======================================
--- /trunk/tools/api-checker/config/gwt20_21userApi.conf Tue Feb 9
21:44:59 2010
+++ /trunk/tools/api-checker/config/gwt20_21userApi.conf Wed Feb 10
08:14:42 2010
@@ -104,3 +104,6 @@
# Adding StackLayoutPanel.add overrides.
com.google.gwt.user.client.ui.StackLayoutPanel::add(Lcom/google/gwt/user/client/ui/Widget;Lcom/google/gwt/user/client/ui/Widget;D)
OVERLOADED_METHOD_CALL
+
+# Removing HTTPRequest.
+com.google.gwt.user.client.HTTPRequest MISSING
=======================================
--- /trunk/user/test/com/google/gwt/http/HTTPSuite.java Mon Oct 12 14:48:21
2009
+++ /trunk/user/test/com/google/gwt/http/HTTPSuite.java Wed Feb 10 08:14:42
2010
@@ -15,7 +15,6 @@
*/
package com.google.gwt.http;
-import com.google.gwt.http.client.HTTPRequestTest;
import com.google.gwt.http.client.RequestBuilderTest;
import com.google.gwt.http.client.RequestTest;
import com.google.gwt.http.client.ResponseTest;
@@ -34,7 +33,6 @@
GWTTestSuite suite = new GWTTestSuite(
"Test for suite for the com.google.gwt.http module");
- suite.addTestSuite(HTTPRequestTest.class);
suite.addTestSuite(URLTest.class);
suite.addTestSuite(RequestBuilderTest.class);
suite.addTestSuite(RequestTest.class);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors