This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Tomcat and the fly likes does CoyoteOutputStream write it chunks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "does CoyoteOutputStream write it chunks" Watch "does CoyoteOutputStream write it chunks" New topic

does CoyoteOutputStream write it chunks

Smo Nerona

Joined: May 19, 2011
Posts: 2
When sending large files from client to server I found that using httpUrlConnection. setChunkedStreamingMode(65536) made it faster because the server would start receiving files while the client ist still sending it. Probably httpUrlConnection.setFixedLengthStreamingMode(contentLength) also has the same effect. Also, there is less memory use as the entire file does not have to be loaded into memory.

Now on the server side, when sending a large file to client, does it send by blocks/chunks? I found that response.getOutputStream() returns a CoyoteOutputStream. Looking at the source code of this file and, which is in the same package, it looks like perhaps it does send by chunks. But I'm not totally sure.

Out of curiosity, do other web servers also send back by chunks?

I agree. Here's the link:
subject: does CoyoteOutputStream write it chunks
It's not a secret anymore!