• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Commiting response to the browser

 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,
I understand that commiting the response and calling sendRedirect() will throw IllegalStateException. Is there anything in the spec about when the appserver commits the response? I know I can commit the response by calling PrintWriter.flush() or HttpServletResponse.flushBuffer().
I was under the assumption that when the buffer gets full, the appserver automatically commits the response. To test this theory, I set the buffer size to 1 using response.setBufferSize(1). After that line, I wrote couple of lines of simple output to the browser using HttpServletResponse.getWriter(). The app server didn't seem to commit automatically. Also I don't know the units for the buffer size. Are they set and get in KB?
Thanks
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you read the documentation for setBufferSize : The servlet container will use a buffer at least as large as the size requested. The actual buffer size used can be found using getBufferSize.
This to me means that the server can ignore requests for setting the buffer size to too small a value. Try calling getBufferSize after your set and see what the server did set it to.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
calls to getBufferSize() returns whatever I set using setBufferSize(). I also found something interesting. Call to setBufferSize(0), immediately commits response after every PrintWriter.println() statement.
I am using weblogic server 6.1
[ April 24, 2003: Message edited by: Sai Prasad ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic