HttpServletResponse « Tomcat « JSP-Servlet Q&A

1. How to pretty print HttpServletRequest and HttpServletResponse

I would like to add logging of requests and responses to a Java webapp which I am running within Tomcat 6. The intention is to produce a log file with output ...

2. tomcat 6 . How does HttpServletResponse make browsers react immediately , not have done response.getOutputStream().close()??

This is the code in my servlet:

while( bytes....){//do read file to bytes
    log4j.debug(response.isCommitted());  // out  true.
If ...