You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2004/06/13 22:22:20 UTC
cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/server SimpleHttpServerConnection.java
olegk 2004/06/13 13:22:20
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpMethod.java HttpMethodBase.java
httpclient/src/java/org/apache/commons/httpclient/methods
EntityEnclosingMethod.java GetMethod.java
HeadMethod.java MultipartPostMethod.java
TraceMethod.java
httpclient/src/test/org/apache/commons/httpclient
TestBadContentLength.java TestGetMethodLocal.java
TestMethodsExternalHost.java
TestMethodsLocalHost.java TestStreams.java
TestTraceMethodLocal.java TestWebappBasicAuth.java
TestWebappHeaders.java TestWebappMethods.java
httpclient/src/test/org/apache/commons/httpclient/server
SimpleHttpServerConnection.java
Log:
HttpMethod#recycle deprecated
Revision Changes Path
1.40 +7 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java
Index: HttpMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- HttpMethod.java 17 May 2004 21:46:03 -0000 1.39
+++ HttpMethod.java 13 Jun 2004 20:22:18 -0000 1.40
@@ -458,6 +458,9 @@
* release the connection being used by this HTTP method.
*
* @see #releaseConnection()
+ *
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
void recycle();
1.208 +7 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
Index: HttpMethodBase.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -r1.207 -r1.208
--- HttpMethodBase.java 13 May 2004 04:03:24 -0000 1.207
+++ HttpMethodBase.java 13 Jun 2004 20:22:19 -0000 1.208
@@ -1014,6 +1014,9 @@
* release the connection being used by this HTTP method.
*
* @see #releaseConnection()
+ *
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
LOG.trace("enter HttpMethodBase.recycle()");
1.38 +7 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java
Index: EntityEnclosingMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- EntityEnclosingMethod.java 13 May 2004 04:02:01 -0000 1.37
+++ EntityEnclosingMethod.java 13 Jun 2004 20:22:19 -0000 1.38
@@ -504,6 +504,9 @@
* release the connection being used by this HTTP method.
*
* @see #releaseConnection()
+ *
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
LOG.trace("enter EntityEnclosingMethod.recycle()");
1.29 +7 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- GetMethod.java 18 Apr 2004 23:51:37 -0000 1.28
+++ GetMethod.java 13 Jun 2004 20:22:19 -0000 1.29
@@ -114,6 +114,9 @@
* @see #releaseConnection()
*
* @since 1.0
+ *
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
LOG.trace("enter GetMethod.recycle()");
1.29 +7 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- HeadMethod.java 18 Apr 2004 23:51:37 -0000 1.28
+++ HeadMethod.java 13 Jun 2004 20:22:19 -0000 1.29
@@ -116,6 +116,9 @@
* @see #releaseConnection()
*
* @since 1.0
+ *
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
super.recycle();
1.26 +5 -3 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java
Index: MultipartPostMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- MultipartPostMethod.java 13 May 2004 04:02:01 -0000 1.25
+++ MultipartPostMethod.java 13 Jun 2004 20:22:19 -0000 1.26
@@ -318,6 +318,8 @@
*
* @see #releaseConnection()
*
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
LOG.trace("enter MultipartPostMethod.recycle()");
1.16 +2 -0 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/TraceMethod.java
Index: TraceMethod.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/TraceMethod.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TraceMethod.java 18 Apr 2004 23:51:37 -0000 1.15
+++ TraceMethod.java 13 Jun 2004 20:22:19 -0000 1.16
@@ -96,6 +96,8 @@
*
* @since 2.0
*
+ * @deprecated no longer supported and will be removed in the future
+ * version of HttpClient
*/
public void recycle() {
super.recycle();
1.7 +6 -6 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestBadContentLength.java
Index: TestBadContentLength.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestBadContentLength.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestBadContentLength.java 27 Feb 2004 19:01:33 -0000 1.6
+++ TestBadContentLength.java 13 Jun 2004 20:22:19 -0000 1.7
@@ -109,7 +109,7 @@
assertEquals(200, m.getStatusCode());
assertEquals("12345", m.getResponseBodyAsString());
- m.recycle();
+ m = new GetMethod("http://localhost:" + server.getLocalPort() + "/");
client.executeMethod(m);
assertEquals(200, m.getStatusCode());
@@ -145,7 +145,7 @@
assertEquals(200, m.getStatusCode());
assertEquals("12345", m.getResponseBodyAsString());
- m.recycle();
+ m = new GetMethod("http://localhost:" + server.getLocalPort() + "/");
client.executeMethod(m);
assertEquals(200, m.getStatusCode());
1.15 +5 -49 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java
Index: TestGetMethodLocal.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestGetMethodLocal.java 22 Feb 2004 18:08:49 -0000 1.14
+++ TestGetMethodLocal.java 13 Jun 2004 20:22:19 -0000 1.15
@@ -84,57 +84,13 @@
HttpClient client = createHttpClient();
- GetMethod getSlash = new GetMethod("/");
for(int i=0;i<10;i++) {
+ GetMethod getSlash = new GetMethod("/");
assertEquals(200, client.executeMethod(getSlash));
String data = getSlash.getResponseBodyAsString();
assertTrue(null != data);
assertTrue(data.length() > 0);
- getSlash.recycle();
- getSlash.setPath("/");
}
- }
-
- public void testRecycle() {
- HttpClient client = createHttpClient(null);
-
- GetMethod method = new GetMethod("/");
-
- try {
- client.executeMethod(method);
- } catch (Throwable t) {
- t.printStackTrace();
- fail("Unable to execute method : " + t.toString());
- }
-
- try {
- String data = method.getResponseBodyAsString();
- assertTrue("No data returned.",(data.length() > 0));
- } catch (Throwable t) {
- t.printStackTrace();
- fail("Unable to execute method : " + t.toString());
- }
- assertEquals(200,method.getStatusCode());
-
- method.recycle();
- method.setPath("/");
-
- try {
- client.executeMethod(method);
- } catch (Throwable t) {
- t.printStackTrace();
- fail("Unable to execute method : " + t.toString());
- }
-
- try {
- String data = method.getResponseBodyAsString();
- assertTrue("No data returned.",(data.length() > 0));
- } catch (Throwable t) {
- t.printStackTrace();
- fail("Unable to execute method : " + t.toString());
- }
- assertEquals(200,method.getStatusCode());
-
}
public void test404() {
1.14 +5 -6 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java
Index: TestMethodsExternalHost.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TestMethodsExternalHost.java 13 Jun 2004 12:13:08 -0000 1.13
+++ TestMethodsExternalHost.java 13 Jun 2004 20:22:19 -0000 1.14
@@ -144,8 +144,7 @@
fail("Unable to execute method : " + t.toString());
}
- method.recycle();
- method.setPath(externalPath);
+ method = new GetMethod(externalUri);
executeMethod();
try {
1.14 +6 -8 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsLocalHost.java
Index: TestMethodsLocalHost.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsLocalHost.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TestMethodsLocalHost.java 22 Feb 2004 18:08:49 -0000 1.13
+++ TestMethodsLocalHost.java 13 Jun 2004 20:22:19 -0000 1.14
@@ -128,8 +128,7 @@
fail("Unable to execute method : " + t.toString());
}
- method.recycle();
- method.setPath("/index.html");
+ method = new GetMethod("/index.html");
try {
client.executeMethod(method);
@@ -179,8 +178,7 @@
assertEquals(200, method.getStatusCode());
- method.recycle();
- method.setPath(path);
+ method = new HeadMethod(path);
try {
client.executeMethod(method);
1.16 +4 -5 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java
Index: TestStreams.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TestStreams.java 11 Mar 2004 20:55:27 -0000 1.15
+++ TestStreams.java 13 Jun 2004 20:22:19 -0000 1.16
@@ -73,8 +73,7 @@
footer = method.getResponseFooter("footer2");
assertEquals(footer.getValue(), "fghij");
- // recycle the method so that it can be reused below
- method.recycle();
+ method = new SimpleHttpMethod();
//Test for when buffer is smaller than chunk size.
in = new ChunkedInputStream(new ByteArrayInputStream(
1.8 +1 -2 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestTraceMethodLocal.java
Index: TestTraceMethodLocal.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestTraceMethodLocal.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestTraceMethodLocal.java 22 Feb 2004 18:08:49 -0000 1.7
+++ TestTraceMethodLocal.java 13 Jun 2004 20:22:19 -0000 1.8
@@ -129,8 +129,7 @@
fail("Unable to execute method : " + t.toString());
}
- method.recycle();
- method.setPath("/");
+ method = new TraceMethod("/");
try {
client.executeMethod(method);
1.19 +9 -14 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java
Index: TestWebappBasicAuth.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TestWebappBasicAuth.java 13 Jun 2004 12:13:08 -0000 1.18
+++ TestWebappBasicAuth.java 13 Jun 2004 20:22:19 -0000 1.19
@@ -94,8 +94,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: GET</title>") >= 0);
assertTrue(method.getResponseBodyAsString().indexOf("<p>You have authenticated as \"jakarta:commons\"</p>") >= 0);
- method.recycle();
- method.setPath("/" + getWebappContext() + "/auth/basic");
+ method = new GetMethod("/" + getWebappContext() + "/auth/basic");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -125,8 +124,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: POST</title>") >= 0);
assertTrue(method.getResponseBodyAsString().indexOf("<p>You have authenticated as \"jakarta:commons\"</p>") >= 0);
- method.recycle();
- method.setPath("/" + getWebappContext() + "/auth/basic");
+ method = new PostMethod("/" + getWebappContext() + "/auth/basic");
method.setRequestBody(new NameValuePair[] { new NameValuePair("testing","one") } );
try {
client.executeMethod(method);
@@ -156,8 +154,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>BasicAuth Servlet: PUT</title>") >= 0);
assertTrue(method.getResponseBodyAsString().indexOf("<p>You have authenticated as \"jakarta:commons\"</p>") >= 0);
- method.recycle();
- method.setPath("/" + getWebappContext() + "/auth/basic");
+ method = new PutMethod("/" + getWebappContext() + "/auth/basic");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -187,8 +184,7 @@
new AuthScope(getHost(), getPort(), "BasicAuthServlet"),
new UsernamePasswordCredentials("jakarta","commons"));
- method.recycle();
- method.setPath("/" + getWebappContext() + "/auth/basic");
+ method = new GetMethod("/" + getWebappContext() + "/auth/basic");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -218,8 +214,7 @@
new AuthScope(getHost(), getPort(), "BasicAuthServlet"),
new UsernamePasswordCredentials("bad","creds"));
- method.recycle();
- method.setPath("/" + getWebappContext() + "/auth/basic");
+ method = new GetMethod("/" + getWebappContext() + "/auth/basic");
try {
client.executeMethod(method);
} catch (Throwable t) {
1.13 +5 -7 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappHeaders.java
Index: TestWebappHeaders.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappHeaders.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestWebappHeaders.java 12 Apr 2004 11:16:25 -0000 1.12
+++ TestWebappHeaders.java 13 Jun 2004 20:22:19 -0000 1.13
@@ -180,9 +180,7 @@
assertTrue(hostHeader.getValue().equals(ip + ":" + getPort()));
}
- // reset
- get.recycle();
- get.setPath("/" + getWebappContext() + "/");
+ get = new GetMethod("/" + getWebappContext() + "/");
// Open connection using Host. Host header should
// contain this value (this test will fail if DNS
1.23 +15 -37 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappMethods.java
Index: TestWebappMethods.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappMethods.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- TestWebappMethods.java 12 May 2004 20:43:54 -0000 1.22
+++ TestWebappMethods.java 13 Jun 2004 20:22:19 -0000 1.23
@@ -88,9 +88,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>Param Servlet: GET</title>") >= 0);
assertEquals(200,method.getStatusCode());
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new GetMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -117,9 +115,7 @@
assertTrue(method.getResponseBodyAsString().indexOf("<title>Param Servlet: POST</title>") >= 0);
assertEquals(200,method.getStatusCode());
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new PostMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -144,9 +140,7 @@
}
assertEquals(200,method.getStatusCode());
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new HeadMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -171,9 +165,7 @@
assertEquals(200,method.getStatusCode());
assertTrue(method.getAllowedMethods().hasMoreElements());
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new OptionsMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -214,9 +206,7 @@
}
assertEquals(200,method.getStatusCode());
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new DeleteMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -241,9 +231,7 @@
assertEquals(200,method.getStatusCode());
assertTrue(method.getResponseBodyAsString(),method.getResponseBodyAsString().indexOf("<title>Param Servlet: PUT</title>") >= 0);
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/params");
+ method = new PutMethod("/" + getWebappContext() + "/params");
try {
client.executeMethod(method);
} catch (Throwable t) {
@@ -347,9 +335,7 @@
assertEquals(200,method.getStatusLine().getStatusCode());
String response = method.getResponseBodyAsString();
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/body");
+ method = new PostMethod("/" + getWebappContext() + "/body");
method.setRequestHeader("Content-Type", "text/plain");
method.setRequestEntity(new ByteArrayRequestEntity(body));
client.executeMethod(method);
@@ -367,18 +353,14 @@
String response = method.getResponseBodyAsString();
assertTrue(response.indexOf("No body submitted") >= 0);
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/body");
+ method = new PostMethod("/" + getWebappContext() + "/body");
method.setRequestHeader("Content-Type", "text/plain");
client.executeMethod(method);
assertEquals(200,method.getStatusLine().getStatusCode());
response = method.getResponseBodyAsString();
assertTrue(response.indexOf("No body submitted") >= 0);
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/body");
+ method = new PostMethod("/" + getWebappContext() + "/body");
method.setRequestHeader("Content-Type", "text/plain");
method.setRequestEntity(new StringRequestEntity(""));
client.executeMethod(method);
@@ -386,9 +368,7 @@
response = method.getResponseBodyAsString();
assertTrue(response.indexOf("No body submitted") >= 0);
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/body");
+ method = new PostMethod("/" + getWebappContext() + "/body");
method.setRequestHeader("Content-Type", "text/plain");
method.setContentChunked(true);
client.executeMethod(method);
@@ -396,9 +376,7 @@
response = method.getResponseBodyAsString();
assertTrue(response.indexOf("No body submitted") >= 0);
- method.recycle();
-
- method.setPath("/" + getWebappContext() + "/body");
+ method = new PostMethod("/" + getWebappContext() + "/body");
method.setRequestHeader("Content-Type", "text/plain");
method.setRequestEntity(new StringRequestEntity(""));
method.setContentChunked(true);
1.9 +4 -4 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServerConnection.java
Index: SimpleHttpServerConnection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServerConnection.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SimpleHttpServerConnection.java 11 May 2004 20:43:55 -0000 1.8
+++ SimpleHttpServerConnection.java 13 Jun 2004 20:22:20 -0000 1.9
@@ -68,7 +68,7 @@
this.out = socket.getOutputStream();
}
- public void destroy() {
+ public synchronized void destroy() {
try {
if (socket != null) {
in.close();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org