Return-Path: Delivered-To: apmail-jakarta-httpclient-commits-archive@www.apache.org Received: (qmail 71830 invoked from network); 4 Feb 2006 20:29:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Feb 2006 20:29:06 -0000 Received: (qmail 86149 invoked by uid 500); 4 Feb 2006 20:29:05 -0000 Mailing-List: contact httpclient-commits-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: httpclient-dev@jakarta.apache.org Delivered-To: mailing list httpclient-commits@jakarta.apache.org Received: (qmail 86138 invoked by uid 99); 4 Feb 2006 20:29:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2006 12:29:05 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 04 Feb 2006 12:29:04 -0800 Received: (qmail 71723 invoked by uid 65534); 4 Feb 2006 20:28:44 -0000 Message-ID: <20060204202844.71722.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r374920 - in /jakarta/httpcomponents/trunk/http-core/src: contrib/org/apache/http/contrib/compress/ java/org/apache/http/ java/org/apache/http/entity/ java/org/apache/http/impl/entity/ test/org/apache/http/entity/ Date: Sat, 04 Feb 2006 20:28:42 -0000 To: httpclient-commits@jakarta.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: olegk Date: Sat Feb 4 12:28:25 2006 New Revision: 374920 URL: http://svn.apache.org/viewcvs?rev=374920&view=rev Log: Changelog: - HttpEntity#writeTo no longer returns a boolean value - HttpEntity#writeTo is required to stream out the complete entity's content Modified: jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/HttpEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BasicHttpEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BufferedHttpEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/ByteArrayEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/FileEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/HttpEntityWrapper.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/InputStreamEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/StringEntity.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultClientEntityWriter.java jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultServerEntityWriter.java jakarta/httpcomponents/trunk/http-core/src/test/org/apache/http/entity/TestHttpEntities.java Modified: jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/contrib/org/apache/http/contrib/compress/GzipCompressingEntity.java Sat Feb 4 12:28:25 2006 @@ -69,7 +69,7 @@ return true; } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } @@ -81,8 +81,6 @@ gzip.write(tmp, 0, l); } gzip.close(); - outstream.close(); - return true; } } // class GzipCompressingEntity Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/HttpEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/HttpEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/HttpEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/HttpEntity.java Sat Feb 4 12:28:25 2006 @@ -136,21 +136,13 @@ InputStream getContent() throws IOException; /** - * Writes the entity content to the output stream either partially or entirely. - * This method may either write the entire content in one go, if it is feasible - * to do so, or store the output stream as a local variable and use it internally - * to write the content in parts. In the former case this method MUST return - * true to indicate that the output stream can be closed. In the latter - * case the output stream MUST be closed once the last content part is written - * in order to ensure that content codings that emit a closing chunk are properly - * terminated. + * Writes the entity content to the output stream. * * @param outstream the output stream to write entity content to - * @return true if the entire entity content has been written, - * false otherwise. + * * @throws IOException if an I/O error occurs */ - boolean writeTo(OutputStream outstream) throws IOException; + void writeTo(OutputStream outstream) throws IOException; /** * Tells whether this entity depends on an underlying stream. Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BasicHttpEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BasicHttpEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BasicHttpEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BasicHttpEntity.java Sat Feb 4 12:28:25 2006 @@ -101,12 +101,12 @@ this.content = instream; } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } if (this.content == null) { - return true; + return; } InputStream instream = this.content; int l; @@ -114,7 +114,6 @@ while ((l = instream.read(tmp)) != -1) { outstream.write(tmp, 0, l); } - return true; } Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BufferedHttpEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BufferedHttpEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BufferedHttpEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/BufferedHttpEntity.java Sat Feb 4 12:28:25 2006 @@ -98,15 +98,14 @@ } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } if (this.buffer != null) { outstream.write(this.buffer); - return true; } else { - return wrappedEntity.writeTo(outstream); + wrappedEntity.writeTo(outstream); } } Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/ByteArrayEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/ByteArrayEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/ByteArrayEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/ByteArrayEntity.java Sat Feb 4 12:28:25 2006 @@ -67,13 +67,12 @@ return new ByteArrayInputStream(this.content); } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } outstream.write(this.content); outstream.flush(); - return true; } Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/FileEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/FileEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/FileEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/FileEntity.java Sat Feb 4 12:28:25 2006 @@ -68,7 +68,7 @@ return new FileInputStream(this.file); } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } @@ -79,7 +79,6 @@ outstream.write(tmp, 0, l); } outstream.flush(); - return true; } /** Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/HttpEntityWrapper.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/HttpEntityWrapper.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/HttpEntityWrapper.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/HttpEntityWrapper.java Sat Feb 4 12:28:25 2006 @@ -94,9 +94,9 @@ return wrappedEntity.getContent(); } - public boolean writeTo(OutputStream outstream) + public void writeTo(OutputStream outstream) throws IOException { - return wrappedEntity.writeTo(outstream); + wrappedEntity.writeTo(outstream); } public boolean isStreaming() { Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/InputStreamEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/InputStreamEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/InputStreamEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/InputStreamEntity.java Sat Feb 4 12:28:25 2006 @@ -70,7 +70,7 @@ return this.content; } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } @@ -85,7 +85,6 @@ outstream.write(buffer, 0, l); remaining -= l; } - return true; } // non-javadoc, see interface HttpEntity Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/StringEntity.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/StringEntity.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/StringEntity.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/entity/StringEntity.java Sat Feb 4 12:28:25 2006 @@ -80,13 +80,12 @@ return new ByteArrayInputStream(this.content); } - public boolean writeTo(final OutputStream outstream) throws IOException { + public void writeTo(final OutputStream outstream) throws IOException { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } outstream.write(this.content); outstream.flush(); - return true; } /** Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultClientEntityWriter.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultClientEntityWriter.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultClientEntityWriter.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultClientEntityWriter.java Sat Feb 4 12:28:25 2006 @@ -82,9 +82,8 @@ } else { outstream = new ContentLengthOutputStream(datatransmitter, len); } - if (entity.writeTo(outstream)) { - outstream.close(); - } + entity.writeTo(outstream); + outstream.close(); } } Modified: jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultServerEntityWriter.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultServerEntityWriter.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultServerEntityWriter.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/java/org/apache/http/impl/entity/DefaultServerEntityWriter.java Sat Feb 4 12:28:25 2006 @@ -79,9 +79,8 @@ } else { outstream = new IdentityOutputStream(datatransmitter); } - if (entity.writeTo(outstream)) { - outstream.close(); - } + entity.writeTo(outstream); + outstream.close(); } } Modified: jakarta/httpcomponents/trunk/http-core/src/test/org/apache/http/entity/TestHttpEntities.java URL: http://svn.apache.org/viewcvs/jakarta/httpcomponents/trunk/http-core/src/test/org/apache/http/entity/TestHttpEntities.java?rev=374920&r1=374919&r2=374920&view=diff ============================================================================== --- jakarta/httpcomponents/trunk/http-core/src/test/org/apache/http/entity/TestHttpEntities.java (original) +++ jakarta/httpcomponents/trunk/http-core/src/test/org/apache/http/entity/TestHttpEntities.java Sat Feb 4 12:28:25 2006 @@ -88,7 +88,7 @@ httpentity.setContent(content); ByteArrayOutputStream out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); byte[] bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length); @@ -97,14 +97,14 @@ } out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(0, bytes2.length); httpentity.setContent(null); out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(0, bytes2.length); @@ -148,7 +148,7 @@ ByteArrayEntity httpentity = new ByteArrayEntity(bytes); ByteArrayOutputStream out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); byte[] bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length); @@ -157,7 +157,7 @@ } out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length); @@ -216,7 +216,7 @@ StringEntity httpentity = new StringEntity(s); ByteArrayOutputStream out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); byte[] bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length); @@ -225,7 +225,7 @@ } out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length); @@ -275,7 +275,7 @@ InputStreamEntity httpentity = new InputStreamEntity(instream, 7); ByteArrayOutputStream out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); byte[] bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(7, bytes2.length); @@ -285,7 +285,7 @@ instream = new ByteArrayInputStream(bytes); httpentity = new InputStreamEntity(instream, 20); out = new ByteArrayOutputStream(); - assertTrue(httpentity.writeTo(out)); + httpentity.writeTo(out); bytes2 = out.toByteArray(); assertNotNull(bytes2); assertEquals(bytes.length, bytes2.length);