Return-Path: Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@www.apache.org Received: (qmail 41348 invoked from network); 2 Mar 2004 14:06:39 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Mar 2004 14:06:39 -0000 Received: (qmail 92770 invoked by uid 500); 2 Mar 2004 14:06:24 -0000 Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@jakarta.apache.org Received: (qmail 92726 invoked by uid 500); 2 Mar 2004 14:06:23 -0000 Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Commons HttpClient Project" Reply-To: "Commons HttpClient Project" Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 92645 invoked from network); 2 Mar 2004 14:06:23 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 2 Mar 2004 14:06:22 -0000 Received: (qmail 29659 invoked by uid 50); 2 Mar 2004 14:06:51 -0000 Date: 2 Mar 2004 14:06:51 -0000 Message-ID: <20040302140651.29658.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: commons-httpclient-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 27366] New: - GetMethod.getResponseBodyAsStream() .available() could return content-length X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27366 GetMethod.getResponseBodyAsStream() .available() could return content-length Summary: GetMethod.getResponseBodyAsStream() .available() could return content-length Product: Commons Version: 2.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: HttpClient AssignedTo: commons-httpclient-dev@jakarta.apache.org ReportedBy: armhold@cs.rutgers.edu It would be nice if the InputStream returned from GetMethod.getResponseBodyAsStream() could override the available() method to return the content-length of the requested URL. This would make things like ProgressMonitorInputStream useful for monitoring the progress of a download. Here is a code snippet: /** * supply a hard-coded value for available() method. */ class FixedInputStream extends FilterInputStream { private int contentLength; public FixedInputStream(InputStream is, int contentLength) { super(is); this.contentLength = contentLength; } public int available() throws IOException { return contentLength; } } Also, somewhat related to this request, could GetMethod.getResponseContentLength() must be made public? Is there a good reason for it to be protected? I had to extend GetMethod and implement a public getResponseContentLength() in order to feed that value to my FixedInputStream. Thanks for your time. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org