public class BildDownloader extends HttpServlet {
private static final String MIME = "image/jpeg";
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//auf doPost umleiten
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
byte[] bilddaten = // wie auch immer...
response.setContentType(MIME);
response.setHeader("Content-disposition", "inline; filename="bild.jpg");
response.setHeader("pragma", "cache");
response.getOutputStream().write(bilddaten);
}
}