提交 4cdf3435 authored 作者: 许俊's avatar 许俊

修改

上级 63b86b8b
......@@ -2,8 +2,10 @@ package org.jeecg.modules.iost.basedata.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.util.PropertiesUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.iost.API.Util.FileUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
......@@ -13,6 +15,7 @@ import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
......@@ -52,13 +55,13 @@ public class DownLoadController {
@ApiOperation(value = "下载APK2", notes = "下载APK2")
@GetMapping("/download2.apk")
public void download2(HttpServletRequest request, HttpServletResponse response) throws IOException {
InputStream in=getClass().getClassLoader().getResourceAsStream("res/test.apk");
/* InputStream in=getClass().getClassLoader().getResourceAsStream("res/test.apk");*/
response.setContentType("application/vnd.android.package-archive");
//读取文件
/*File file = new File("D:\\file\\test.apk");*/
byte[] body = null;
/*InputStream in = new FileInputStream(file);*/
/* InputStream in = getClass().getClassLoader().getResourceAsStream("res/test.apk");*/
InputStream in = getClass().getClassLoader().getResourceAsStream("res/test.apk");
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
//创建存放文件内容的数组
byte[] buff = new byte[1024];
......@@ -76,5 +79,12 @@ public class DownLoadController {
in.close();
}
@RequestMapping("downApp")
@ResponseBody
public void Download(HttpServletResponse response) {
String fileName = "wuye.apk";
String result = FileUtil.downloadFile(response, fileName);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论