private String downloadFile(PackageDownloadInfo packageDownloadInfo, ModelMap modelMap, HttpServletRequest request) {
		String region = packageDownloadInfo.getRegion();
		packageDownloadInfo.setConnectionIp(request.getServerName());
		packageDownloadInfo.setConnectionPort(config.getControllerPort());
		try {
			if (config.isClustered()) {
				checkNotEmpty(region, "region should be provided to download agent in cluster mode.");
				RegionInfo regionInfo = checkNotNull(regionService.getOne(region), "selecting region '" + region + "'" +
						" is not valid");

				packageDownloadInfo.setConnectionIp(regionInfo.getIp());
				packageDownloadInfo.setConnectionPort(regionInfo.getPort());
			}
			final File agentPackage = agentPackageService.createAgentPackage(packageDownloadInfo);
			modelMap.clear();
			return "redirect:/agent/download/" + agentPackage.getName();
		} catch (Exception e) {
			throw processException(e);
		}
	}
Download the latest agent.

@param packageDownloadInfo information for downloading agent.
@param request request.
ngrinder-controller/src/main/java/org/ngrinder/agent/controller/AgentDownloadController.java