hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1098106 - in /httpcomponents/httpclient/trunk/httpclient/src: main/java/org/apache/http/conn/params/ main/java/org/apache/http/impl/conn/ test/java/org/apache/http/impl/conn/
Date Sat, 30 Apr 2011 12:42:44 GMT
Author: olegk
Date: Sat Apr 30 12:42:44 2011
New Revision: 1098106

URL: http://svn.apache.org/viewvc?rev=1098106&view=rev
Log:
Deprecated ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionPNames.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionParamBean.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionPNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionPNames.java?rev=1098106&r1=1098105&r2=1098106&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionPNames.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionPNames.java
Sat Apr 30 12:42:44 2011
@@ -26,11 +26,14 @@
 
 package org.apache.http.conn.params;
 
+import org.apache.http.impl.conn.DefaultResponseParser;
+
 /**
  * Parameter names for HTTP client connections.
  *
  * @since 4.0
  */
+@Deprecated
 public interface ConnConnectionPNames {
 
     /**
@@ -49,6 +52,8 @@ public interface ConnConnectionPNames {
      * 0 disallows all garbage/empty lines before the status line.
      * Use {@link java.lang.Integer#MAX_VALUE} for unlimited number.
      * </p>
+     *
+     * @deprecated Use custom {@link DefaultResponseParser} implementation
      */
     public static final String MAX_STATUS_LINE_GARBAGE = "http.connection.max-status-line-garbage";
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionParamBean.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionParamBean.java?rev=1098106&r1=1098105&r2=1098106&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionParamBean.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/params/ConnConnectionParamBean.java
Sat Apr 30 12:42:44 2011
@@ -29,6 +29,7 @@ package org.apache.http.conn.params;
 
 import org.apache.http.annotation.NotThreadSafe;
 
+import org.apache.http.impl.conn.DefaultResponseParser;
 import org.apache.http.params.HttpAbstractParamBean;
 import org.apache.http.params.HttpParams;
 
@@ -40,6 +41,7 @@ import org.apache.http.params.HttpParams
  * @since 4.0
  */
 @NotThreadSafe
+@Deprecated
 public class ConnConnectionParamBean extends HttpAbstractParamBean {
 
     public ConnConnectionParamBean (final HttpParams params) {
@@ -47,7 +49,7 @@ public class ConnConnectionParamBean ext
     }
 
     /**
-     * @see ConnConnectionPNames#MAX_STATUS_LINE_GARBAGE
+     * @deprecated Use custom {@link DefaultResponseParser} implementation
      */
     public void setMaxStatusLineGarbage (final int maxStatusLineGarbage) {
         params.setIntParameter(ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, maxStatusLineGarbage);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java?rev=1098106&r1=1098105&r2=1098106&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
Sat Apr 30 12:42:44 2011
@@ -39,7 +39,6 @@ import org.apache.http.HttpResponseFacto
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.StatusLine;
-import org.apache.http.conn.params.ConnConnectionPNames;
 import org.apache.http.impl.io.AbstractMessageParser;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.message.LineParser;
@@ -81,10 +80,18 @@ public class DefaultResponseParser exten
         }
         this.responseFactory = responseFactory;
         this.lineBuf = new CharArrayBuffer(128);
-        this.maxGarbageLines = params.getIntParameter(
-            ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE);
+        this.maxGarbageLines = getMaxGarbageLines(params);
     }
 
+    /**
+     * @since 4.2
+     */
+    @SuppressWarnings("deprecation")
+    protected int getMaxGarbageLines(final HttpParams params) {
+        return params.getIntParameter(
+                org.apache.http.conn.params.ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE,
+                Integer.MAX_VALUE);
+    }
 
     @Override
     protected HttpMessage parseHead(

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java?rev=1098106&r1=1098105&r2=1098106&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java
Sat Apr 30 12:42:44 2011
@@ -32,7 +32,6 @@ import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
-import org.apache.http.conn.params.ConnConnectionPNames;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.SessionInputBuffer;
@@ -91,13 +90,19 @@ public class TestDefaultResponseParser {
             "\r\n";
 
         HttpParams params = new BasicHttpParams();
-        params.setParameter(ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.valueOf(2));
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(s, "US-ASCII", params);
         HttpMessageParser parser = new DefaultResponseParser(
                 inbuffer,
                 BasicLineParser.DEFAULT,
                 new DefaultHttpResponseFactory(),
-                params);
+                params) {
+
+                    @Override
+                    protected int getMaxGarbageLines(HttpParams params) {
+                        return 2;
+                    }
+
+        };
         parser.parse();
     }
 



Mime
View raw message