hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r568003 - in /jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn: DefaultClientConnection.java DefaultClientConnectionOperator.java DefaultResponseParser.java
Date Tue, 21 Aug 2007 08:06:01 GMT
Author: rolandw
Date: Tue Aug 21 01:06:00 2007
New Revision: 568003

URL: http://svn.apache.org/viewvc?rev=568003&view=rev
Log:
HTTPCORE-110, adjustment to API changes

Modified:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java?rev=568003&r1=568002&r2=568003&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
Tue Aug 21 01:06:00 2007
@@ -43,6 +43,7 @@
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
+import org.apache.http.message.LineParser;
 import org.apache.http.params.HttpParams;
 import org.apache.http.impl.SocketHttpClientConnection;
 import org.apache.http.io.HttpMessageParser;
@@ -80,6 +81,8 @@
     /** Whether this connection is secure. */
     private boolean connSecure;
 
+    /** The line parser to use, or <code>null</code> for the default parser.
*/
+    private LineParser lineParser;
 
 
     // public default constructor
@@ -131,6 +134,26 @@
 
     } // shutdown
 
+
+    /**
+     * Obtains the line parser to be used for receiving messages.
+     *
+     * @return  the line parser, or <code>null</code> for the default
+     */
+    public LineParser getParser() {
+        return lineParser;
+    }
+
+    /**
+     * Specifies the line parser to use when receiving messages.
+     *
+     * @param parser    the line parser to use, or
+     *                  <code>null</code> for the default
+     */
+    public final void setParser(LineParser parser) {
+        lineParser = parser;
+    }
+
     
     public void close() throws IOException {
         LOG.debug("Connection closed");
@@ -172,7 +195,8 @@
             final SessionInputBuffer buffer,
             final HttpResponseFactory responseFactory, 
             final HttpParams params) {
-        return new DefaultResponseParser(buffer, responseFactory, params);
+        return new DefaultResponseParser
+            (buffer, lineParser, responseFactory, params);
     }
 
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java?rev=568003&r1=568002&r2=568003&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java
Tue Aug 21 01:06:00 2007
@@ -36,6 +36,7 @@
 import java.net.InetAddress;
 
 import org.apache.http.HttpHost;
+import org.apache.http.message.LineParser;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.protocol.HttpContext;
@@ -69,6 +70,12 @@
     /** The scheme registry for looking up socket factories. */
     protected SchemeRegistry schemeRegistry;
 
+    /**
+     * The line parser to use for created connections.
+     * <code>null</code> indicates the default parser.
+     */
+    protected LineParser lineParser;
+
 
     /**
      * Creates a new client connection operator for the given scheme registry.
@@ -84,9 +91,31 @@
     }
 
 
+    /**
+     * Obtains the line parser to be used by the connections.
+     *
+     * @return  the line parser, or <code>null</code> for the default
+     */
+    public LineParser getParser() {
+        return lineParser;
+    }
+
+
+    /**
+     * Specifies the line parser to be used by the connections.
+     *
+     * @param parser    the line parser, or <code>null</code> for the default
+     */
+    public void setParser(LineParser parser) {
+        lineParser = parser;
+    }
+
+
     // non-javadoc, see interface ClientConnectionOperator
     public OperatedClientConnection createConnection() {
-        return new DefaultClientConnection();
+        DefaultClientConnection dcc = new DefaultClientConnection();
+        dcc.setParser(lineParser);
+        return dcc;
     }
 
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java?rev=568003&r1=568002&r2=568003&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
Tue Aug 21 01:06:00 2007
@@ -42,7 +42,8 @@
 import org.apache.http.conn.params.HttpConnectionManagerParams;
 import org.apache.http.impl.io.AbstractMessageParser;
 import org.apache.http.io.SessionInputBuffer;
-import org.apache.http.message.BasicStatusLine;
+import org.apache.http.message.LineParser;
+//@@@ import org.apache.http.message.BasicStatusLine;
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.util.CharArrayBuffer;
@@ -55,11 +56,13 @@
     
     public DefaultResponseParser(
             final SessionInputBuffer buffer,
+            final LineParser parser,
             final HttpResponseFactory responseFactory,
             final HttpParams params) {
-        super(buffer, params);
+        super(buffer, parser, params);
         if (responseFactory == null) {
-            throw new IllegalArgumentException("Response factory may not be null");
+            throw new IllegalArgumentException
+                ("Response factory may not be null");
         }
         this.responseFactory = responseFactory;
         this.lineBuf = new CharArrayBuffer(128);
@@ -111,7 +114,7 @@
             count++;
         } while(true);
         //create the status line from the status string
-        StatusLine statusline = BasicStatusLine.parse(this.lineBuf, 0, this.lineBuf.length());
+        StatusLine statusline = lineParser.parseStatusLine(this.lineBuf, 0, this.lineBuf.length());
         return this.responseFactory.newHttpResponse(statusline, null);
     }
 



Mime
View raw message