hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r472563 - in /jakarta/httpcomponents/httpcore/trunk/module-main/src: main/java/org/apache/http/entity/ main/java/org/apache/http/impl/ main/java/org/apache/http/impl/entity/ test/java/org/apache/http/impl/entity/
Date Wed, 08 Nov 2006 17:52:21 GMT
Author: olegk
Date: Wed Nov  8 09:52:20 2006
New Revision: 472563

URL: http://svn.apache.org/viewvc?view=rev&rev=472563
Log:
Removed superfluous EntityDeserializer and EntitySerializer public interfaces

Removed:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/entity/EntityDeserializer.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/entity/EntitySerializer.java
Modified:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntityDeserializer.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntitySerializer.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntitySerializer.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
Wed Nov  8 09:52:20 2006
@@ -43,8 +43,10 @@
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.StatusLine;
-import org.apache.http.entity.EntityDeserializer;
-import org.apache.http.entity.EntitySerializer;
+import org.apache.http.impl.entity.DefaultEntityDeserializer;
+import org.apache.http.impl.entity.DefaultEntitySerializer;
+import org.apache.http.impl.entity.LaxContentLengthStrategy;
+import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.io.CharArrayBuffer;
 import org.apache.http.io.HttpDataReceiver;
 import org.apache.http.io.HttpDataTransmitter;
@@ -72,19 +74,23 @@
     private int maxHeaderCount = -1;
 
     private final CharArrayBuffer buffer; 
+    private final DefaultEntitySerializer entityserializer;
+    private final DefaultEntityDeserializer entitydeserializer;
     
     /*
      * Dependent interfaces
      */
     private HttpResponseFactory responsefactory = null;
-    private EntitySerializer entityserializer = null;
-    private EntityDeserializer entitydeserializer = null;
     private HttpDataReceiver datareceiver = null;
     private HttpDataTransmitter datatransmitter = null;
 
     public AbstractHttpClientConnection() {
         super();
         this.buffer = new CharArrayBuffer(128);
+        this.entityserializer = new DefaultEntitySerializer(
+                new StrictContentLengthStrategy());
+        this.entitydeserializer = new DefaultEntityDeserializer(
+                new LaxContentLengthStrategy());
     }
     
     protected abstract void assertOpen() throws IllegalStateException;
@@ -98,20 +104,6 @@
             throw new IllegalArgumentException("Factory may not be null");
         }
         this.responsefactory = responsefactory;
-    }
-
-    protected void setEntityDeserializer(final EntityDeserializer entitydeserializer) {
-        if (entitydeserializer == null) {
-            throw new IllegalArgumentException("Entity deserializer may not be null");
-        }
-        this.entitydeserializer = entitydeserializer;
-    }
-
-    protected void setEntitySerializer(final EntitySerializer entityserializer) {
-        if (entityserializer == null) {
-            throw new IllegalArgumentException("Entity serializer may not be null");
-        }
-        this.entityserializer = entityserializer;
     }
 
     protected void setHttpDataReceiver(final HttpDataReceiver datareceiver) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
Wed Nov  8 09:52:20 2006
@@ -42,8 +42,10 @@
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpServerConnection;
 import org.apache.http.RequestLine;
-import org.apache.http.entity.EntityDeserializer;
-import org.apache.http.entity.EntitySerializer;
+import org.apache.http.impl.entity.DefaultEntityDeserializer;
+import org.apache.http.impl.entity.DefaultEntitySerializer;
+import org.apache.http.impl.entity.LaxContentLengthStrategy;
+import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.io.CharArrayBuffer;
 import org.apache.http.io.HttpDataReceiver;
 import org.apache.http.io.HttpDataTransmitter;
@@ -69,19 +71,23 @@
     private int maxHeaderCount = -1;
     
     private final CharArrayBuffer buffer; 
+    private final DefaultEntitySerializer entityserializer;
+    private final DefaultEntityDeserializer entitydeserializer;
     
     /*
      * Dependent interfaces
      */
     private HttpRequestFactory requestfactory = null; 
-    private EntitySerializer entityserializer = null;
-    private EntityDeserializer entitydeserializer = null;
     private HttpDataReceiver datareceiver = null;
     private HttpDataTransmitter datatransmitter = null;
 
     public AbstractHttpServerConnection() {
         super();
         this.buffer = new CharArrayBuffer(128);
+        this.entityserializer = new DefaultEntitySerializer(
+                new StrictContentLengthStrategy());
+        this.entitydeserializer = new DefaultEntityDeserializer(
+                new LaxContentLengthStrategy());
     }
     
     protected abstract void assertOpen() throws IllegalStateException;
@@ -95,20 +101,6 @@
             throw new IllegalArgumentException("Factory may not be null");
         }
         this.requestfactory = requestfactory;
-    }
-
-    protected void setEntityDeserializer(final EntityDeserializer entitydeserializer) {
-        if (entitydeserializer == null) {
-            throw new IllegalArgumentException("Entity deserializer may not be null");
-        }
-        this.entitydeserializer = entitydeserializer;
-    }
-
-    protected void setEntitySerializer(final EntitySerializer entityserializer) {
-        if (entityserializer == null) {
-            throw new IllegalArgumentException("Entity serializer may not be null");
-        }
-        this.entityserializer = entityserializer;
     }
 
     protected void setHttpDataReceiver(final HttpDataReceiver datareceiver) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
Wed Nov  8 09:52:20 2006
@@ -32,10 +32,6 @@
 import java.io.IOException;
 import java.net.Socket;
 
-import org.apache.http.impl.entity.DefaultEntityDeserializer;
-import org.apache.http.impl.entity.DefaultEntitySerializer;
-import org.apache.http.impl.entity.LaxContentLengthStrategy;
-import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.impl.io.SocketHttpDataReceiver;
 import org.apache.http.impl.io.SocketHttpDataTransmitter;
 import org.apache.http.io.HttpDataReceiver;
@@ -105,10 +101,6 @@
         setHttpDataTransmitter(transmitter);
         setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
         setResponseFactory(new DefaultHttpResponseFactory());
-        setEntitySerializer(new DefaultEntitySerializer(
-                new StrictContentLengthStrategy()));
-        setEntityDeserializer(new DefaultEntityDeserializer(
-                new LaxContentLengthStrategy()));
         this.open = true;
     }
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
Wed Nov  8 09:52:20 2006
@@ -32,10 +32,6 @@
 import java.io.IOException;
 import java.net.Socket;
 
-import org.apache.http.impl.entity.DefaultEntityDeserializer;
-import org.apache.http.impl.entity.DefaultEntitySerializer;
-import org.apache.http.impl.entity.LaxContentLengthStrategy;
-import org.apache.http.impl.entity.StrictContentLengthStrategy;
 import org.apache.http.impl.io.SocketHttpDataReceiver;
 import org.apache.http.impl.io.SocketHttpDataTransmitter;
 import org.apache.http.io.HttpDataReceiver;
@@ -103,10 +99,6 @@
         setHttpDataTransmitter(transmitter);
         setMaxHeaderCount(params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1));
         setRequestFactory(new DefaultHttpRequestFactory());
-        setEntitySerializer(new DefaultEntitySerializer(
-                new StrictContentLengthStrategy()));
-        setEntityDeserializer(new DefaultEntityDeserializer(
-                new LaxContentLengthStrategy()));
         this.open = true;
     }
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntityDeserializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntityDeserializer.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntityDeserializer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntityDeserializer.java
Wed Nov  8 09:52:20 2006
@@ -37,7 +37,6 @@
 import org.apache.http.HttpMessage;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.entity.EntityDeserializer;
 import org.apache.http.io.ChunkedInputStream;
 import org.apache.http.io.ContentLengthInputStream;
 import org.apache.http.io.HttpDataInputStream;
@@ -56,7 +55,7 @@
  * 
  * @since 4.0
  */
-public class DefaultEntityDeserializer implements EntityDeserializer {
+public class DefaultEntityDeserializer {
 
     private final ContentLengthStrategy lenStrategy;
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntitySerializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntitySerializer.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntitySerializer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/entity/DefaultEntitySerializer.java
Wed Nov  8 09:52:20 2006
@@ -36,7 +36,6 @@
 import org.apache.http.HttpException;
 import org.apache.http.HttpMessage;
 import org.apache.http.entity.ContentLengthStrategy;
-import org.apache.http.entity.EntitySerializer;
 import org.apache.http.io.ChunkedOutputStream;
 import org.apache.http.io.ContentLengthOutputStream;
 import org.apache.http.io.HttpDataTransmitter;
@@ -54,7 +53,7 @@
  * 
  * @since 4.0
  */
-public class DefaultEntitySerializer implements EntitySerializer {
+public class DefaultEntitySerializer {
 
     private final ContentLengthStrategy lenStrategy;
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntityDeserializer.java
Wed Nov  8 09:52:20 2006
@@ -30,11 +30,13 @@
 
 import java.io.InputStream;
 
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpMessage;
 import org.apache.http.ProtocolException;
-import org.apache.http.entity.EntityDeserializer;
-import org.apache.http.impl.entity.DefaultEntityDeserializer;
 import org.apache.http.io.ChunkedInputStream;
 import org.apache.http.io.ContentLengthInputStream;
 import org.apache.http.io.HttpDataInputStream;
@@ -43,10 +45,6 @@
 import org.apache.http.mockup.HttpMessageMockup;
 import org.apache.http.params.HttpProtocolParams;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 public class TestDefaultEntityDeserializer extends TestCase {
 
     public TestDefaultEntityDeserializer(String testName) {
@@ -66,7 +64,7 @@
     }
 
     public void testIllegalGenerateArg() throws Exception {
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         try {
             entitygen.deserialize(null, null);
@@ -91,7 +89,7 @@
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "identity, chunked");
         message.addHeader("Content-Length", "plain wrong");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -118,7 +116,7 @@
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "identity");
         message.addHeader("Content-Length", "plain wrong");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -135,7 +133,7 @@
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "whatever; param=value, chunked");
         message.addHeader("Content-Length", "plain wrong");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -162,7 +160,7 @@
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "chunked, identity");
         message.addHeader("Content-Length", "plain wrong");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -188,7 +186,7 @@
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING,
false);
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Content-Length", "0");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -207,7 +205,7 @@
         message.addHeader("Content-Length", "0");
         message.addHeader("Content-Length", "0");
         message.addHeader("Content-Length", "1");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -237,7 +235,7 @@
         message.addHeader("Content-Length", "1");
         message.addHeader("Content-Length", "yyy");
         message.addHeader("Content-Length", "xxx");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -266,7 +264,7 @@
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Content-Length", "yyy");
         message.addHeader("Content-Length", "xxx");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -295,7 +293,7 @@
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING,
false);
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Content-Length", "xxx");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -322,7 +320,7 @@
 
         // lenient mode 
         message.getParams().setBooleanParameter(HttpProtocolParams.STRICT_TRANSFER_ENCODING,
false);
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -340,7 +338,7 @@
         HttpMessage message = new HttpMessageMockup();
 
         message.addHeader("Content-Type", "stuff");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);
@@ -353,7 +351,7 @@
         HttpMessage message = new HttpMessageMockup();
 
         message.addHeader("Content-Encoding", "what not");
-        EntityDeserializer entitygen = new DefaultEntityDeserializer(
+        DefaultEntityDeserializer entitygen = new DefaultEntityDeserializer(
                 new LaxContentLengthStrategy());
         HttpEntity entity = entitygen.deserialize(datareceiver, message);
         assertNotNull(entity);

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntitySerializer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntitySerializer.java?view=diff&rev=472563&r1=472562&r2=472563
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntitySerializer.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/entity/TestDefaultEntitySerializer.java
Wed Nov  8 09:52:20 2006
@@ -38,7 +38,6 @@
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolException;
 import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.EntitySerializer;
 import org.apache.http.io.ChunkedOutputStream;
 import org.apache.http.io.ContentLengthOutputStream;
 import org.apache.http.io.HttpDataTransmitter;
@@ -66,7 +65,7 @@
     }
 
     public void testIllegalGenerateArg() throws Exception {
-        EntitySerializer entitywriter = new DefaultEntitySerializer(
+        DefaultEntitySerializer entitywriter = new DefaultEntitySerializer(
                 new StrictContentLengthStrategy());
         try {
             entitywriter.serialize(null, null, null);



Mime
View raw message