/* 
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package org.ngrinder.agent.controller;

import org.ngrinder.common.controller.NGrinderBaseController;
import org.ngrinder.common.util.FileDownloadUtil;
import org.ngrinder.infra.config.Config;
import org.ngrinder.infra.init.AgentPackageInitializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.File;

/**
 * Agent Download Controller.
 *
 * @author Tobi
 * @since 3.0
 */
@Controller
@RequestMapping("/agent")
public class AgentDownloadController extends NGrinderBaseController {

	@Autowired
	private Config config;

	@Autowired
	private AgentPackageInitializer agentPackageInitializer;

	/**
	 * Download agent's latest version.
	 *
	 * @param response response.
	 */
	@RequestMapping(value = "/download")
	public void download(HttpServletResponse response) {
		FileDownloadUtil.downloadFile(response, agentPackageInitializer.getAgentPackageFile());
	}

}

@@ -1404,16 +1404,421 @@
 lizer;%0A%0A
+%09/**%0A%09 * Download agent.%0A%09 *%0A%09 * @param fileName file path of agent%0A%09 * @param response response.%0A%09 */%0A%09@RequestMapping(value = %22/download/%7BfileName:%5Ba-zA-Z0-9%5C%5C.%5C%5C-%5D+%7D%22)%0A%09public void downloadAgent(@PathVariable String fileName, HttpServletResponse response) %7B%0A%09%09File ngrinderFile = new File(config.getHome().getDownloadDirectory(), fileName);%0A%09%09FileDownloadUtil.downloadFile(response, ngrinderFile);%0A%09%7D%0A%0A
 %09/**%0A%09 *
@@ -1949,16 +1949,27 @@
 download
+LatestAgent
 (HttpSer

Make agent direct download available again