在Service里创建一个方法,将HttpMarsResponse作为参数传入

  1. public void downLoad(HttpMarsResponse response) {
  2. try {
  3. File file = new File("/Users/yuye/Desktop/demo.mov");
  4. InputStream inputStream = new FileInputStream(file);
  5. response.downLoad("文件名.后缀",inputStream);
  6. } catch (Exception e){
  7.  
  8. }
  9. }

如果想接收前端传来的参数,可以看目录《接受参数》