• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

'Buffer' Question: What does 'written to the client' mean?

 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to understand JSP buffering through these 2 methods: out.clear() and response.flushBuffer().
By definition, flushBuffer() will force the content of the 'buffer' to be written to the client. So what does 'written to the client' mean?
Does this mean that there will be a partial response(i.e. stream of data transmitted) to the clients HTTP request whose content is that of the flushed buffer?

Or does it mean that the data are moved from the JSP buffer to another 'out buffer' that still resides in the server, and the data in that 'out buffer' is transmitted to the client in one go when the JSP completes.

The last scenario makes sense because if I call out.clear() even after I call response.flushBuffer(), the client will still get a blank response.
Thanks.
[ February 25, 2004: Message edited by: Alton Hernandez ]
 
Ivan Matmati
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Effectively, if you call flushBuffer on servletResponse, the response will be committed to the client with headers and status code.
If you call out.clear() after the response has been committed by flushBuffer an IOException must be thrown.That's certainly why you get a blank page.
It's your first scenario that is correct.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic