第一种方法
后端代码
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
@RequestMapping("getImage.do")
@ResponseBody
public void getEventPicture(HttpServletRequest request, HttpServletResponse response, String imgPath) {
FTPClient ftp=null;
InputStream in = null;
OutputStream os = null;
try {
ftp= initFTP(ftp);
//下载文件 FTP协议里面,规定文件名编码为iso-8859-1,所以读取时要将文件名转码为iso-8859-1
//如果没有设置按照UTF-8读,获取的流是空值null
in = ftp.retrieveFileStream(new String(imgPath.getBytes("UTF-8"), "iso-8859-1"));
String picType = imgPath.split