public static boolean downloadFile(HttpServletResponse response, File file) {
		if (file == null || !file.exists()) {
			return false;
		}

		boolean result = true;
		response.reset();
		response.addHeader("Content-Disposition", "attachment;filename=" + file.getName());
		response.setContentType("application/octet-stream");
		response.addHeader("Content-Length", "" + file.length());

		try (InputStream fis = new BufferedInputStream(new FileInputStream(file));
			 OutputStream toClient = new BufferedOutputStream(response.getOutputStream())) {
			copyLarge(fis, toClient);
		} catch (FileNotFoundException e) {
			log.error("file not found:" + file.getAbsolutePath(), e);
			result = false;
		} catch (IOException e) {
			log.error("read file error:" + file.getAbsolutePath(), e);
			result = false;
		}

		return result;
	}
Download the given file to the given {@link HttpServletResponse}.

@param response {@link HttpServletResponse}
@param file     file path
@return true if succeeded
ngrinder-controller/src/main/java/org/ngrinder/common/util/FileDownloadUtils.java