在Service里创建一个方法,将HttpMarsResponse作为参数传入
- public void downLoad(HttpMarsResponse response) {
- try {
- File file = new File("/Users/yuye/Desktop/demo.mov");
- InputStream inputStream = new FileInputStream(file);
- response.downLoad("文件名.后缀",inputStream);
- } catch (Exception e){
- }
- }
如果想接收前端传来的参数,可以看目录《接受参数》