code: public void generateOutput() throws IOException {
  
          HttpServletResponse res = CmsFlexController.getController(getJsp().getRequest()).getTopResponse();
          res.setContentType("application/octet-stream");
          res.setHeader(
              "Content-Disposition",
              new StringBuffer("attachment; filename=\"").append(getDownloadFile().getName()).append("\"").toString());
          res.setContentLength((int)getDownloadFile().length());
  
          // getOutputStream() throws IllegalStateException if the jsp directive buffer="none" is set.
          ServletOutputStream outStream = res.getOutputStream();
          InputStream in = new BufferedInputStream(new FileInputStream(getDownloadFile()));
  
          try {
              // don't write the last '-1'
              int bit = in.read();
              while ((bit) >= 0) {
                  outStream.write(bit);
                  bit = in.read();
              }
          } catch (SocketException soe) {
              // this is the case for ie if cancel in download window is chosen:
              // "Connection reset by peer: socket write error". But not for firefox -> don't care
          } finally {
              if (outStream != null) {
                  try {
                      outStream.flush();
                      outStream.close();
                  } catch (SocketException soe) {
                      // ignore
                  }
              }
              in.close();
          }
      }
docs: Generates the output.<p>
  
  @throws IOException if something goes wrong