hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r610464 - in /httpcomponents/httpcore/trunk: ./ contrib/src/main/java/org/apache/http/contrib/benchmark/ module-main/src/examples/org/apache/http/examples/ module-main/src/main/java/org/apache/http/message/ module-main/src/main/java/org/apa...
Date Wed, 09 Jan 2008 17:11:23 GMT
Author: olegk
Date: Wed Jan  9 09:10:55 2008
New Revision: 610464

URL: http://svn.apache.org/viewvc?rev=610464&view=rev
Log:
Replaced HTTP parameter linking with a simple child/parent stack

Added:
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
  (with props)
Removed:
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpLinkedParams.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpParamsLinker.java
Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
    httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/message/AbstractHttpMessage.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpService.java
    httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestSessionBuffers.java
    httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/TestHttpClient.java
    httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/params/TestBasicHttpParams.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
    httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Wed Jan  9 09:10:55 2008
@@ -1,5 +1,8 @@
 Changes since 4.0 Alpha 6
 
+* Replaced HTTP parameter linking with a simple child/parent stack.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCORE-134] all serialVersionUID attributes are private
   Contributed by Roland Weber <rolandw at apache.org>
 

Modified: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java
(original)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/BenchmarkWorker.java
Wed Jan  9 09:10:55 2008
@@ -48,8 +48,9 @@
 import org.apache.http.HttpStatus;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.DefaultHttpClientConnection;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
@@ -136,7 +137,7 @@
         this.context.setAttribute(ExecutionContext.HTTP_REQUEST, this.request);
 
         stats.start();
-        HttpParamsLinker.link(this.request, this.params);
+        request.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
         for (int i = 0; i < count; i++) {
 
             try {

Modified: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java
(original)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/benchmark/HttpBenchmark.java
Wed Jan  9 09:10:55 2008
@@ -190,7 +190,7 @@
     }
 
     private static HttpParams getHttpParams() {
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         params.setParameter(HttpProtocolParams.PROTOCOL_VERSION, HttpVersion.HTTP_1_1)
             .setParameter(HttpProtocolParams.USER_AGENT, "Jakarta-HttpComponents-Bench/1.1")
             .setBooleanParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false)

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpGet.java
Wed Jan  9 09:10:55 2008
@@ -68,7 +68,7 @@
 
     public static void main(String[] args) throws Exception {
         
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
         HttpProtocolParams.setContentCharset(params, "UTF-8");
         HttpProtocolParams.setUserAgent(params, "HttpComponents/1.1");

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpPost.java
Wed Jan  9 09:10:55 2008
@@ -73,7 +73,7 @@
 
     public static void main(String[] args) throws Exception {
         
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
         HttpProtocolParams.setContentCharset(params, "UTF-8");
         HttpProtocolParams.setUserAgent(params, "HttpComponents/1.1");

Modified: httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
Wed Jan  9 09:10:55 2008
@@ -175,7 +175,7 @@
         
         public RequestListenerThread(int port, final String docroot) throws IOException {
             this.serversocket = new ServerSocket(port);
-            this.params = new BasicHttpParams(null);
+            this.params = new BasicHttpParams();
             this.params
                 .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
                 .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/message/AbstractHttpMessage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/message/AbstractHttpMessage.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/message/AbstractHttpMessage.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/message/AbstractHttpMessage.java
Wed Jan  9 09:10:55 2008
@@ -57,11 +57,7 @@
     protected AbstractHttpMessage(final HttpParams params) {
         super();
         this.headergroup = new HeaderGroup();
-        if (params != null) {
-            this.params = params;
-        } else {
-            this.params = new BasicHttpParams();
-        }
+        this.params = params;
     }
 
     protected AbstractHttpMessage() {
@@ -154,6 +150,9 @@
     
     // non-javadoc, see interface HttpMessage
     public HttpParams getParams() {
+        if (this.params == null) {
+            this.params = new BasicHttpParams();
+        }
         return this.params;
     }
     

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java
Wed Jan  9 09:10:55 2008
@@ -50,52 +50,15 @@
  * @version $Revision$
  */
 public final class BasicHttpParams extends AbstractHttpParams
-    implements HttpLinkedParams, Serializable, Cloneable {
+    implements Serializable, Cloneable {
 
     private static final long serialVersionUID = -7086398485908701455L;
 
-    /**
-     * The optional set of default values to defer to.
-     */
-    protected HttpParams defaults;
-
     /** Map of HTTP parameters that this collection contains. */
     private HashMap parameters;
 
-    /**
-     * Creates a new collection of parameters with the given parent. 
-     * The collection will defer to its parent for a default value 
-     * if a particular parameter is not explicitly set in the collection
-     * itself.
-     * 
-     * @param defaults the parent collection to defer to, if a parameter
-     * is not explictly set in the collection itself.
-     */
-    public BasicHttpParams(final HttpParams defaults) {
-        super();
-        setDefaults(defaults); // perform ancestor check
-    }
-
     public BasicHttpParams() {
-        this(null);
-    }
-
-    /**
-     * Obtains default parameters, if set.
-     *
-     * @return  the defaults, or <code>null</code>
-     */
-    public HttpParams getDefaults() {
-        return this.defaults;
-    }
-    
-    /**
-     * Provides default parameters.
-     *
-     * @param params    the new defaults, or <code>null</code> to unset
-     */
-    public void setDefaults(final HttpParams params) {
-        this.defaults = params;
+        super();
     }
 
     public Object getParameter(final String name) {
@@ -104,19 +67,7 @@
         if (this.parameters != null) {
             param = this.parameters.get(name);
         }    
-        if (param != null) {
-            // If so, return
-            return param;
-        } else {
-            // If not, see if defaults are available
-            if (this.defaults != null) {
-                // Return default parameter value
-                return this.defaults.getParameter(name);
-            } else {
-                // Otherwise, return null
-                return null;
-            }
-        }
+        return param;
     }
 
     public HttpParams setParameter(final String name, final Object value) {
@@ -170,22 +121,14 @@
 
     /**
      * Creates a copy of these parameters.
-     * The implementation here instantiates {@link BasicHttpParams}
-     * with the same default parameters as this object, then calls
-     * {@link #copyParams(HttpParams)} to populate the copy.
-     * <br/>
-     * Derived classes which have to change the class that is
-     * instantiated can override this method here. Derived classes
-     * which have to change how the copy is populated can override
-     * {@link #copyParams(HttpParams)}.
+     * The implementation here instantiates {@link BasicHttpParams}, 
+     * then calls {@link #copyParams(HttpParams)} to populate the copy.
      *
      * @return  a new set of params holding a copy of the
      *          <i>local</i> parameters in this object.
-     *          Defaults parameters available via {@link #getDefaults}
-     *          are <i>not</i> copied.
      */
     public HttpParams copy() {
-        BasicHttpParams clone = new BasicHttpParams(this.defaults);
+        BasicHttpParams clone = new BasicHttpParams();
         copyParams(clone);
         return clone;
     }
@@ -198,8 +141,6 @@
  
     /**
      * Copies the locally defined parameters to the argument parameters.
-     * Default parameters accessible via {@link #getDefaults}
-     * are <i>not</i> copied.
      * This method is called from {@link #copy()}.
      *
      * @param target    the parameters to which to copy

Added: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java?rev=610464&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
(added)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
Wed Jan  9 09:10:55 2008
@@ -0,0 +1,87 @@
+/*
+ * $HeadURL:$
+ * $Revision:$
+ * $Date:$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.params;
+
+import org.apache.http.params.HttpParams;
+
+
+/**
+ * Simple two level stack of HTTP parameters (child/parent).
+ *
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ * @version $Revision:$
+ */
+public final class SimpleParamStack extends AbstractHttpParams {
+
+    private final HttpParams params;
+    private final HttpParams parent;
+    
+    public SimpleParamStack(final HttpParams params, final HttpParams parent) {
+        super();
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
+        this.params = params;
+        this.parent = parent;
+    }
+
+    public HttpParams copy() {
+        HttpParams clone = this.params.copy();
+        return new SimpleParamStack(clone, this.parent);
+    }
+
+    public Object getParameter(final String name) {
+        Object obj = this.params.getParameter(name);
+        if (obj == null && this.parent != null) {
+            obj = this.parent.getParameter(name);
+        }
+        return obj;
+    }
+
+    public boolean isParameterSet(final String name) {
+        return this.params.isParameterSet(name);
+    }
+
+    public boolean removeParameter(final String name) {
+        return this.removeParameter(name);
+    }
+
+    public HttpParams setParameter(final String name, final Object value) {
+        return this.params.setParameter(name, value);
+    }
+
+    public HttpParams getParent() {
+        return this.parent;
+    }
+    
+}

Propchange: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/SimpleParamStack.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpService.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpService.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpService.java
Wed Jan  9 09:10:55 2008
@@ -48,8 +48,9 @@
 import org.apache.http.ProtocolVersion;
 import org.apache.http.UnsupportedHttpVersionException;
 import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.util.EncodingUtils;
 
 /**
@@ -133,7 +134,7 @@
         try {
 
             HttpRequest request = conn.receiveRequestHeader();
-            HttpParamsLinker.link(request, this.params);
+            request.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
             
             ProtocolVersion ver =
                 request.getRequestLine().getProtocolVersion();
@@ -147,7 +148,7 @@
                 if (((HttpEntityEnclosingRequest) request).expectContinue()) {
                     response = this.responseFactory.newHttpResponse(ver, 
                             HttpStatus.SC_CONTINUE, context);
-                    HttpParamsLinker.link(response, this.params);
+                    response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
                     
                     if (this.expectationVerifier != null) {
                         try {
@@ -155,7 +156,8 @@
                         } catch (HttpException ex) {
                             response = this.responseFactory.newHttpResponse(HttpVersion.HTTP_1_0,

                                     HttpStatus.SC_INTERNAL_SERVER_ERROR, context);
-                            HttpParamsLinker.link(response, this.params);
+                            response.setParams(
+                                    new SimpleParamStack(new BasicHttpParams(), this.params));
                             handleException(ex, response);
                         }
                     }
@@ -174,7 +176,7 @@
 
             if (response == null) {
                 response = this.responseFactory.newHttpResponse(ver, HttpStatus.SC_OK, context);
-                HttpParamsLinker.link(response, this.params);
+                response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
 
                 context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
                 context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
@@ -195,7 +197,7 @@
             response = this.responseFactory.newHttpResponse
                 (HttpVersion.HTTP_1_0, HttpStatus.SC_INTERNAL_SERVER_ERROR,
                  context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
             handleException(ex, response);
         }
         

Modified: httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestSessionBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestSessionBuffers.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestSessionBuffers.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestSessionBuffers.java
Wed Jan  9 09:10:55 2008
@@ -405,7 +405,7 @@
         String s2 = constructString(RUSSIAN_HELLO);
         String s3 = "Like hello and stuff";
         
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setHttpElementCharset(params, "UTF-8");
         
         SessionOutputBufferMockup outbuffer = new SessionOutputBufferMockup(params);
@@ -446,7 +446,7 @@
     public void testNonAsciiReadWriteLine() throws Exception {
         String s1 = constructString(SWISS_GERMAN_HELLO);
         
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
         
         SessionOutputBufferMockup outbuffer = new SessionOutputBufferMockup(params);

Modified: httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/TestHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/TestHttpClient.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/TestHttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/mockup/TestHttpClient.java
Wed Jan  9 09:10:55 2008
@@ -44,8 +44,8 @@
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
@@ -67,7 +67,7 @@
     
     public TestHttpClient() {
         super();
-        this.params = new BasicHttpParams(null);
+        this.params = new BasicHttpParams();
         this.params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
             .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
@@ -99,10 +99,11 @@
         this.context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
         this.context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, targetHost);
         this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
-        HttpParamsLinker.link(request, params);
+
+        request.setParams(new SimpleParamStack(request.getParams(), this.params));
         this.httpexecutor.preProcess(request, this.httpproc, this.context);
         HttpResponse response = this.httpexecutor.execute(request, conn, this.context);
-        HttpParamsLinker.link(response, params);
+        response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
         this.httpexecutor.postProcess(response, this.httpproc, this.context);
         return response;
     }

Modified: httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/params/TestBasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/params/TestBasicHttpParams.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/params/TestBasicHttpParams.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/params/TestBasicHttpParams.java
Wed Jan  9 09:10:55 2008
@@ -58,8 +58,9 @@
 
 
     public void testCopyParams() {
-        BasicHttpParams parent = new BasicHttpParams();
-        BasicHttpParams child  = new BasicHttpParams(parent);
+        HttpParams parent = new BasicHttpParams();
+        HttpParams child  = new SimpleParamStack(
+                new BasicHttpParams(), parent);
         parent.setParameter("parent", "something");
         child.setParameter("child", "something");
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpClient.java
Wed Jan  9 09:10:55 2008
@@ -67,7 +67,7 @@
 public class NHttpClient {
 
     public static void main(String[] args) throws Exception {
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
             .setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 10000)

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpFileServer.java
Wed Jan  9 09:10:55 2008
@@ -73,8 +73,8 @@
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
@@ -289,7 +289,7 @@
             
             HttpResponse response =  this.responseFactory.newHttpResponse(
                     HttpVersion.HTTP_1_0, HttpStatus.SC_BAD_REQUEST, context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
             
             context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
             context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
@@ -462,7 +462,7 @@
                 final ConnState connState) throws HttpException, IOException {
             HttpContext context = conn.getContext();
             HttpRequest request = conn.getHttpRequest();
-            HttpParamsLinker.link(request, this.params);
+            request.setParams(new SimpleParamStack(request.getParams(), this.params));
 
             if (request instanceof HttpEntityEnclosingRequest) {
                 HttpEntityEnclosingRequest eeRequest = (HttpEntityEnclosingRequest) request;
@@ -477,7 +477,7 @@
             
             ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
             HttpResponse response =  this.responseFactory.newHttpResponse(ver, 200, context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
             
             context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
             context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLClient.java
Wed Jan  9 09:10:55 2008
@@ -69,7 +69,7 @@
 public class NHttpSSLClient {
 
     public static void main(String[] args) throws Exception {
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000)
             .setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 30000)

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpSSLServer.java
Wed Jan  9 09:10:55 2008
@@ -97,7 +97,7 @@
         SSLContext sslcontext = SSLContext.getInstance("TLS");
         sslcontext.init(keymanagers, null, null);
         
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
             .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)

Modified: httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/examples/org/apache/http/examples/nio/NHttpServer.java
Wed Jan  9 09:10:55 2008
@@ -78,7 +78,7 @@
             System.err.println("Please specify document root directory");
             System.exit(1);
         }
-        HttpParams params = new BasicHttpParams(null);
+        HttpParams params = new BasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
             .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpClientHandler.java
Wed Jan  9 09:10:55 2008
@@ -52,9 +52,10 @@
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.nio.util.SimpleInputBuffer;
 import org.apache.http.nio.util.SimpleOutputBuffer;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
@@ -129,7 +130,7 @@
                 return;
             }
             
-            HttpParamsLinker.link(request, this.params);
+            request.setParams(new SimpleParamStack(request.getParams(), this.params));
             
             context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
             this.httpProcessor.process(request, context);
@@ -227,7 +228,7 @@
         ClientConnState connState = (ClientConnState) context.getAttribute(CONN_STATE);
 
         HttpResponse response = conn.getHttpResponse();
-        HttpParamsLinker.link(response, this.params);
+        response.setParams(new SimpleParamStack(new BasicHttpParams(), this.params));
         
         HttpRequest request = connState.getRequest();
         

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/BufferingHttpServiceHandler.java
Wed Jan  9 09:10:55 2008
@@ -60,8 +60,9 @@
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.nio.util.SimpleInputBuffer;
 import org.apache.http.nio.util.SimpleOutputBuffer;
+import org.apache.http.params.BasicHttpParams;
 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;
@@ -114,7 +115,7 @@
         HttpContext context = conn.getContext();
         
         HttpRequest request = conn.getHttpRequest();
-        HttpParamsLinker.link(request, this.params);
+        request.setParams(new SimpleParamStack(request.getParams(), this.params));
 
         ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
 
@@ -137,7 +138,8 @@
                 if (((HttpEntityEnclosingRequest) request).expectContinue()) {
                     response = this.responseFactory.newHttpResponse(
                             ver, HttpStatus.SC_CONTINUE, context);
-                    HttpParamsLinker.link(response, this.params);
+                    response.setParams(
+                            new SimpleParamStack(new BasicHttpParams(), this.params));
                     
                     if (this.expectationVerifier != null) {
                         try {
@@ -147,7 +149,8 @@
                                     HttpVersion.HTTP_1_0, 
                                     HttpStatus.SC_INTERNAL_SERVER_ERROR, 
                                     context);
-                            HttpParamsLinker.link(response, this.params);
+                            response.setParams(
+                                    new SimpleParamStack(new BasicHttpParams(), this.params));
                             handleException(ex, response);
                         }
                     }
@@ -204,7 +207,8 @@
         try {
             HttpResponse response = this.responseFactory.newHttpResponse(
                     HttpVersion.HTTP_1_0, HttpStatus.SC_INTERNAL_SERVER_ERROR, context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(
+                    new SimpleParamStack(new BasicHttpParams(), this.params));
             handleException(httpex, response);
             response.setEntity(null);
             sendResponse(conn, response);
@@ -330,7 +334,8 @@
                 ver, 
                 HttpStatus.SC_OK, 
                 conn.getContext());
-        HttpParamsLinker.link(response, this.params);
+        response.setParams(
+                new SimpleParamStack(new BasicHttpParams(), this.params));
         
         context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
@@ -354,7 +359,8 @@
         } catch (HttpException ex) {
             response = this.responseFactory.newHttpResponse(HttpVersion.HTTP_1_0, 
                     HttpStatus.SC_INTERNAL_SERVER_ERROR, context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(
+                    new SimpleParamStack(new BasicHttpParams(), this.params));
             handleException(ex, response);
         }
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
Wed Jan  9 09:10:55 2008
@@ -57,9 +57,10 @@
 import org.apache.http.nio.util.DirectByteBufferAllocator;
 import org.apache.http.nio.util.SharedInputBuffer;
 import org.apache.http.nio.util.SharedOutputBuffer;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.SimpleParamStack;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
@@ -153,7 +154,7 @@
                     return;
                 }
                 
-                HttpParamsLinker.link(request, this.params);
+                request.setParams(new SimpleParamStack(request.getParams(), this.params));
                 
                 context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
                 this.httpProcessor.process(request, context);
@@ -234,7 +235,8 @@
             
             synchronized (connState) {
                 HttpResponse response = conn.getHttpResponse();
-                HttpParamsLinker.link(response, this.params);
+                response.setParams(
+                        new SimpleParamStack(new BasicHttpParams(), this.params));
                 
                 HttpRequest request = connState.getRequest();
                 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java?rev=610464&r1=610463&r2=610464&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
(original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
Wed Jan  9 09:10:55 2008
@@ -63,8 +63,9 @@
 import org.apache.http.nio.util.DirectByteBufferAllocator;
 import org.apache.http.nio.util.SharedInputBuffer;
 import org.apache.http.nio.util.SharedOutputBuffer;
+import org.apache.http.params.BasicHttpParams;
 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;
@@ -150,7 +151,8 @@
                     HttpVersion.HTTP_1_0, 
                     HttpStatus.SC_INTERNAL_SERVER_ERROR, 
                     context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(
+                    new SimpleParamStack(new BasicHttpParams(), this.params));
             handleException(httpex, response);
             response.setEntity(null);
             
@@ -384,7 +386,7 @@
             connState.setWorkerRunning(true);
         }
 
-        HttpParamsLinker.link(request, this.params);
+        request.setParams(new SimpleParamStack(request.getParams(), this.params));
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
@@ -406,14 +408,16 @@
                         ver, 
                         HttpStatus.SC_CONTINUE, 
                         context);
-                HttpParamsLinker.link(response, this.params);
+                response.setParams(
+                        new SimpleParamStack(new BasicHttpParams(), this.params));
                 if (this.expectationVerifier != null) {
                     try {
                         this.expectationVerifier.verify(request, response, context);
                     } catch (HttpException ex) {
                         response = this.responseFactory.newHttpResponse(HttpVersion.HTTP_1_0,

                                 HttpStatus.SC_INTERNAL_SERVER_ERROR, context);
-                        HttpParamsLinker.link(request, this.params);
+                        response.setParams(
+                                new SimpleParamStack(new BasicHttpParams(), this.params));
                         handleException(ex, response);
                     }
                 }
@@ -467,7 +471,8 @@
                     ver, 
                     HttpStatus.SC_OK, 
                     context);
-            HttpParamsLinker.link(response, this.params);
+            response.setParams(
+                    new SimpleParamStack(new BasicHttpParams(), this.params));
 
             context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
             
@@ -489,7 +494,8 @@
             } catch (HttpException ex) {
                 response = this.responseFactory.newHttpResponse(HttpVersion.HTTP_1_0, 
                         HttpStatus.SC_INTERNAL_SERVER_ERROR, context);
-                HttpParamsLinker.link(response, this.params);
+                response.setParams(
+                        new SimpleParamStack(new BasicHttpParams(), this.params));
                 handleException(ex, response);
             }
         }



Mime
View raw message