我需要从HttpServlet响应中“刷新”OutputStream吗?
我已经看到从到我应该关闭servlet输出流吗?我不需要关闭它,但不清楚是否需要刷新它。我应该也从容器中得到它吗?
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?
}