You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2004/03/02 15:06:51 UTC
DO NOT REPLY [Bug 27366] New: -
GetMethod.getResponseBodyAsStream() .available() could return content-length
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27366>.
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