From 96f2c55a3cee3beaa378d3fbc9a39962fc1803c6 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 9 Jan 2008 17:18:45 +0000 Subject: [PATCH] Replaced HTTP parameter linking with a simple child/parent stack git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@610470 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/http/impl/conn/Helper.java | 6 +++--- .../org/apache/http/impl/conn/TestLocalServer.java | 14 +++++++++----- .../http/impl/conn/tsccm/TestWaitingThread.java | 1 - .../apache/http/localserver/LocalTestServer.java | 2 +- .../apache/http/localserver/ServerTestBase.java | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/module-client/src/test/java/org/apache/http/impl/conn/Helper.java b/module-client/src/test/java/org/apache/http/impl/conn/Helper.java index dc2118478..0cfc5b9da 100644 --- a/module-client/src/test/java/org/apache/http/impl/conn/Helper.java +++ b/module-client/src/test/java/org/apache/http/impl/conn/Helper.java @@ -35,7 +35,7 @@ import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.params.HttpParams; -import org.apache.http.params.HttpParamsLinker; +import org.apache.http.params.SimpleParamStack; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.ExecutionContext; import org.apache.http.protocol.HttpProcessor; @@ -69,10 +69,10 @@ public final class Helper { ctxt.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target); ctxt.setAttribute(ExecutionContext.HTTP_REQUEST, req); - HttpParamsLinker.link(req, params); + req.setParams(new SimpleParamStack(req.getParams(), params)); exec.preProcess(req, proc, ctxt); HttpResponse rsp = exec.execute(req, conn, ctxt); - HttpParamsLinker.link(rsp, params); + rsp.setParams(new SimpleParamStack(rsp.getParams(), params)); exec.postProcess(rsp, proc, ctxt); return rsp; diff --git a/module-client/src/test/java/org/apache/http/impl/conn/TestLocalServer.java b/module-client/src/test/java/org/apache/http/impl/conn/TestLocalServer.java index a1c48d2e0..c808e8ae2 100644 --- a/module-client/src/test/java/org/apache/http/impl/conn/TestLocalServer.java +++ b/module-client/src/test/java/org/apache/http/impl/conn/TestLocalServer.java @@ -42,7 +42,7 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.localserver.LocalTestServer; import org.apache.http.localserver.ServerTestBase; -import org.apache.http.params.HttpParamsLinker; +import org.apache.http.params.SimpleParamStack; import org.apache.http.protocol.ExecutionContext; import org.apache.http.util.EntityUtils; @@ -87,12 +87,14 @@ public class TestLocalServer extends ServerTestBase { httpContext.setAttribute( ExecutionContext.HTTP_REQUEST, request); - HttpParamsLinker.link(request, defaultParams); + request.setParams( + new SimpleParamStack(request.getParams(), defaultParams)); httpExecutor.preProcess (request, httpProcessor, httpContext); HttpResponse response = httpExecutor.execute (request, conn, httpContext); - HttpParamsLinker.link(response, defaultParams); + response.setParams( + new SimpleParamStack(response.getParams(), defaultParams)); httpExecutor.postProcess (response, httpProcessor, httpContext); @@ -130,12 +132,14 @@ public class TestLocalServer extends ServerTestBase { httpContext.setAttribute( ExecutionContext.HTTP_REQUEST, request); - HttpParamsLinker.link(request, defaultParams); + request.setParams( + new SimpleParamStack(request.getParams(), defaultParams)); httpExecutor.preProcess (request, httpProcessor, httpContext); HttpResponse response = httpExecutor.execute (request, conn, httpContext); - HttpParamsLinker.link(response, defaultParams); + response.setParams( + new SimpleParamStack(response.getParams(), defaultParams)); httpExecutor.postProcess (response, httpProcessor, httpContext); diff --git a/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestWaitingThread.java b/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestWaitingThread.java index 215414e74..9d286bc96 100644 --- a/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestWaitingThread.java +++ b/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestWaitingThread.java @@ -30,7 +30,6 @@ package org.apache.http.impl.conn.tsccm; -import java.util.Date; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; diff --git a/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java b/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java index fc142440c..51a066df5 100644 --- a/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java +++ b/module-client/src/test/java/org/apache/http/localserver/LocalTestServer.java @@ -146,7 +146,7 @@ public class LocalTestServer { * @return default parameters */ public static HttpParams newDefaultParams() { - HttpParams params = new BasicHttpParams(null); + HttpParams params = new BasicHttpParams(); params .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000) diff --git a/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java b/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java index fd1547229..67e28e1e0 100644 --- a/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java +++ b/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java @@ -112,7 +112,7 @@ public abstract class ServerTestBase extends TestCase { protected void setUp() throws Exception { if (defaultParams == null) { - defaultParams = new BasicHttpParams(null); + defaultParams = new BasicHttpParams(); HttpProtocolParams.setVersion (defaultParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset