Пример #1
0
  /**
   * <br>
   * [機 能] 添付ファイルダウンロードの処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @throws SQLException SQL実行例外
   * @throws Exception 実行時例外
   * @return ActionForward
   */
  private ActionForward __doDownLoad(
      ActionMapping map,
      Rng020Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws SQLException, Exception {

    RequestModel reqMdl = getRequestModel(req);
    CommonBiz cmnBiz = new CommonBiz();
    String tempDir = cmnBiz.getTempDir(getTempPath(req), RngConst.PLUGIN_ID_RINGI, reqMdl);
    Rng020Biz biz = new Rng020Biz(reqMdl);
    tempDir = biz.getTemplateFileDir(tempDir);
    String fileId = form.getRng020TemplateFileId();

    // オブジェクトファイルを取得
    ObjectFile objFile = new ObjectFile(tempDir, fileId.concat(GSConstCommon.ENDSTR_OBJFILE));
    Object fObj = objFile.load();
    Cmn110FileModel fMdl = (Cmn110FileModel) fObj;
    // 添付ファイル保存用のパスを取得する(フルパス)
    String filePath = tempDir + fileId.concat(GSConstCommon.ENDSTR_SAVEFILE);
    filePath = IOTools.replaceFileSep(filePath);

    GsMessage gsMsg = new GsMessage(reqMdl);
    String msg = gsMsg.getMessage("cmn.download");

    // ログ出力処理
    RngBiz rngBiz = new RngBiz(con);
    rngBiz.outPutLog(map, msg, GSConstLog.LEVEL_INFO, fMdl.getFileName(), reqMdl);

    // 時間のかかる処理の前にコネクションを破棄
    JDBCUtil.closeConnectionAndNull(con);
    // ファイルをダウンロードする
    TempFileUtil.downloadAtachment(req, res, filePath, fMdl.getFileName(), Encoding.UTF_8);

    return null;
  }