/** * the action method for downloading hotel contract * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward download( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HotelContract hotelContract = this.getHotelContractFromRequest(request); Hotel hotel = hotelContract.getHotel(); this.checkHotel(hotel, request); InputStream in = ServiceLocator.getHotelContractManager(request) .getHotelContractContent(hotelContract.getId()); if (in != null) { try { if (hotelContract.getFileSize() == 0) { throw new ActionException("hotelContract.error.fileSize.zero"); } else { DownloadUploadHelper.download( in, hotelContract.getFileName(), DownloadUploadHelper.getMime(hotelContract.getFileName()), hotelContract.getFileSize(), request, response, true); } } finally { in.close(); } } return null; }
/** * the action method for editing hotel contract * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HotelContract hotelContract = getHotelContractFromRequest(request); Hotel hotel = hotelContract.getHotel(); this.checkHotel(hotel, request); request.setAttribute("x_hotelContract", hotelContract); if (!isBack(request)) { BeanForm hotelContractForm = (BeanForm) getForm("/updateHotelContract", request); hotelContractForm.populate(hotelContract, BeanForm.TO_FORM); } putEnumListToRequest(request); return mapping.findForward("page"); }