At 02:47 PM 8/30/2001, you wrote:
>The problem I am having is that tomcat 3.2.3 seems to (kind of) limit 
>content length to Integer.MAX_VALUE (2^31-1 or 2GB).
>
>If I want to serve very large objects things do not work so well.
>
>I seems that ServletResponse.SetContentLength(int) is the prefered manner 
>to sent the content length of a servlet response and that the default 
>implemtation for the "HEAD" method in HttpServlet also is limited to the 
>range of int values.
>
>My reading of the HTTP/1.1 spec does not indicate that there are any 
>limitations to content length in the HTTP protocol.
>
>So my question is:  Am I all messed up, or is Tomcat and the servlet 
>spec/implementation sub-optimal?

The limit of an int is an int, right?
The setContentLength() method takes an int. What
do you want? Rather than try to stuff all your
data in one go you should treat it like the stream
that it is and feed your data into a buffer a blob
at a time, send that data down the pipe when you get
one full blob, and replenish the buffer with a new
blob of data from your source, like most anyone else
would do. Then you don't worry about how much data
you have to send. It could be gigs * gigs. Plus
you have the ability to resend any blobs (records,
frames) that get garbled on the way over, if any.

Much more efficient than trying to stuff your entire
wad down the wire.

Reply via email to