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
This commit is contained in:
Oleg Kalnichevski 2008-01-09 17:18:45 +00:00
parent 33498f875a
commit 96f2c55a3c
5 changed files with 14 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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