res.setContentType("text/html");
ServletOutputStream out = res.getOutputStream();
// ServletOutputStream has println() methods for writing strings
// The println() call only works for single-byte character encodings
// If you need multibyte, make sure to set the charset in the Content-Type
// and use for example out.write(str.getBytes("Shift_JIS")) for Japanese
out.println("Content current as of");
out.println(new Date().toString());
// ... retrieve a database ResultSet here ...
ResultSet resultSet = null;
try {
InputStream ascii = resultSet.getAsciiStream(1);
returnStream(ascii, out);
}
catch (SQLException e) {
throw new ServletException(e);
}