title: Do I need to flush the servlet outputstream?
body: <p>Do I need to "flush" the OutputStream from the HttpServletResponse?</p>
  
  <p>I already saw from to <a href="https://stackoverflow.com/questions/1829784/should-i-close-the-servlet-outputstream">Should I close the servlet outputstream?</a> that I don't need to close it, but it's not clear if I need to flush it. Should I expect it from the container as well?</p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) 
     throws ServletException, IOException {
     byte[] response = getResponse();
     String responseType = getResponseType();
  
     response.setContentLength(response.length);
     response.setContentType(responseType);
     response.getOutputStream().write(response);
     response.getOutputStream().flush(); // yes/no/why?
  }
  </code></pre>