This may be a dumb / ignorant / basic question, but I am brand new to Tomcat, and a little confused.
I'd like to have a user visit a link and have my servlet automatically start a download. I know that I can return text or HTML by using:
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doGet(req, resp);
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
//etc...
}
But how do I return a file that is on my server, and have the browser start a download?