hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r231283 - in /jakarta/httpclient/trunk/http-common/src/java/org/apache/http: ./ entity/ impl/entity/
Date Wed, 10 Aug 2005 17:23:36 GMT
Author: olegk
Date: Wed Aug 10 10:23:26 2005
New Revision: 231283

URL: http://svn.apache.org/viewcvs?rev=231283&view=rev
Log:
Added content encoding attribute to the HttpEntity interface and related classes

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/BufferedHttpEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/ByteArrayEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/InputStreamEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/StringEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/BasicHttpEntity.java
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/DefaultEntityGenerator.java

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpEntity.java (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpEntity.java Wed Aug
10 10:23:26 2005
@@ -52,6 +52,8 @@
     
     String getContentType();
     
+    String getContentEncoding();
+    
     InputStream getContent() throws IOException;
     
     /**

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableEntity.java (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/HttpMutableEntity.java Wed
Aug 10 10:23:26 2005
@@ -46,6 +46,8 @@
     
     void setContentType(String contentType);
     
+    void setContentEncoding(String contentEncoding);
+    
     void setContentLength(long len);
     
     void setContent(InputStream instream);

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/BufferedHttpEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/BufferedHttpEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/BufferedHttpEntity.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/BufferedHttpEntity.java
Wed Aug 10 10:23:26 2005
@@ -75,6 +75,10 @@
         return this.source.getContentType();
     }
     
+    public String getContentEncoding() {
+        return this.source.getContentEncoding();
+    }
+    
     public InputStream getContent() throws IOException {
         if (this.buffer != null) {
             return new ByteArrayInputStream(this.buffer);
@@ -97,10 +101,10 @@
         }
         if (this.buffer != null) {
             outstream.write(this.buffer);
+            return true;
         } else {
-            this.source.writeTo(outstream);
+            return this.source.writeTo(outstream);
         }
-        return true;
     }
     
 }

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/ByteArrayEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/ByteArrayEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/ByteArrayEntity.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/ByteArrayEntity.java
Wed Aug 10 10:23:26 2005
@@ -51,6 +51,7 @@
 
     private final byte[] content;
     private String contentType = DEFAULT_CONTENT_TYPE;
+    private String contentEncoding = null;
     private boolean chunked = false;
 
     public ByteArrayEntity(final byte[] b) {
@@ -81,8 +82,16 @@
         return this.contentType;
     }
 
-    public void setContentType(final String s) {
-        this.contentType = s;
+    public void setContentType(final String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getContentEncoding() {
+        return this.contentEncoding;
+    }
+
+    public void setContentEncoding(final String contentEncoding) {
+        this.contentEncoding = contentEncoding;
     }
 
     public InputStream getContent() {

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/InputStreamEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/InputStreamEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/InputStreamEntity.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/InputStreamEntity.java
Wed Aug 10 10:23:26 2005
@@ -52,6 +52,7 @@
     private final InputStream content;
     private final long length;
     private String contentType = DEFAULT_CONTENT_TYPE;
+    private String contentEncoding = null;
     private boolean chunked = false;
 
     public InputStreamEntity(final InputStream instream, long length) {
@@ -83,8 +84,16 @@
         return this.contentType;
     }
 
-    public void setContentType(final String s) {
-        this.contentType = s;
+    public void setContentType(final String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getContentEncoding() {
+        return this.contentEncoding;
+    }
+
+    public void setContentEncoding(final String contentEncoding) {
+        this.contentEncoding = contentEncoding;
     }
 
     public InputStream getContent() throws IOException {

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/StringEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/StringEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/StringEntity.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/entity/StringEntity.java
Wed Aug 10 10:23:26 2005
@@ -51,6 +51,7 @@
 
     private final String content;
     private String contentType = null;
+    private String contentEncoding = null;
     private boolean chunked = false;
 
     public StringEntity(final String s, final String charset) {
@@ -88,8 +89,16 @@
         return this.contentType;
     }
 
-    public void setContentType(final String s) {
-        this.contentType = s;
+    public void setContentType(final String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getContentEncoding() {
+        return this.contentEncoding;
+    }
+
+    public void setContentEncoding(final String contentEncoding) {
+        this.contentEncoding = contentEncoding;
     }
     
     public InputStream getContent() throws IOException {

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/BasicHttpEntity.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/BasicHttpEntity.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/BasicHttpEntity.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/BasicHttpEntity.java
Wed Aug 10 10:23:26 2005
@@ -47,7 +47,8 @@
  */
 public class BasicHttpEntity implements HttpMutableEntity {
     
-    private String contenttype = null;
+    private String contentType = null;
+    private String contentEncoding = null;
     private InputStream content = null;
     private long length = -1;
     private boolean chunked = false;
@@ -61,7 +62,11 @@
     }
 
     public String getContentType() {
-        return this.contenttype;
+        return this.contentType;
+    }
+    
+    public String getContentEncoding() {
+        return this.contentEncoding;
     }
     
     public InputStream getContent() {
@@ -85,7 +90,11 @@
     }
     
     public void setContentType(final String contentType) {
-        this.contenttype = contentType;
+        this.contentType = contentType;
+    }
+    
+    public void setContentEncoding(final String contentEncoding) {
+        this.contentEncoding = contentEncoding;
     }
     
     public void setContent(final InputStream instream) {

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/DefaultEntityGenerator.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/DefaultEntityGenerator.java?rev=231283&r1=231282&r2=231283&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/DefaultEntityGenerator.java
(original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/entity/DefaultEntityGenerator.java
Wed Aug 10 10:23:26 2005
@@ -189,6 +189,7 @@
     private static final String TRANSFER_ENCODING = "Transfer-Encoding";
     private static final String CONTENT_LENGTH = "Content-Length";
     private static final String CONTENT_TYPE = "Content-Type";
+    private static final String CONTENT_ENCODING = "Content-Encoding";
     
     private static final String CHUNKED_ENCODING = "chunked";
     private static final String IDENTITY_ENCODING = "identity";
@@ -224,6 +225,7 @@
         boolean strict = params.isParameterTrue(HttpProtocolParams.STRICT_TRANSFER_ENCODING);
         
         Header contentTypeHeader = message.getFirstHeader(CONTENT_TYPE);
+        Header contentEncodingHeader = message.getFirstHeader(CONTENT_ENCODING);
         Header transferEncodingHeader = message.getFirstHeader(TRANSFER_ENCODING);
         Header contentLengthHeader = message.getFirstHeader(CONTENT_LENGTH);
         // We use Transfer-Encoding if present and ignore Content-Length.
@@ -299,6 +301,9 @@
         }
         if (contentTypeHeader != null) {
             entity.setContentType(contentTypeHeader.getValue());    
+        }
+        if (contentEncodingHeader != null) {
+            entity.setContentEncoding(contentEncodingHeader.getValue());    
         }
         return entity;
     }



Mime
View raw message