@RequestMapping(value = "/downloadSvt")

public ResponseEntity<FileSystemResource> export() {

HttpHeaders headers = new HttpHeaders();

headers.add("Cache-Control", "no-cache, no-store, must-revalidate");

headers.add("Content-Disposition", "attachment; filename=client.js");

headers.add("Pragma", "no-cache");

headers.add("Expires", "0");

File file = new File("./client.js");

return ResponseEntity.ok().headers(headers).contentLength(file.length())

.contentType(MediaType.parseMediaType("application/octet-stream")).body(new FileSystemResource(file));

}

Springboot Download file的更多相关文章

  1. Csharp:WebClient and WebRequest use http download file

    //Csharp:WebClient and WebRequest use http download file //20140318 塗聚文收錄 string filePath = "20 ...

  2. [Powershell] FTP Download File

    # Config $today = Get-Date -UFormat "%Y%m%d" $LogFilePath = "d:\ftpLog_$today.txt&quo ...

  3. Spring boot download file

    Springboot对资源的描述提供了相应的接口,其主要实现类有ClassPathResource.FileSystemResource.UrlResource.ByteArrayResource. ...

  4. FTP Download File By Some Order List

    @Echo Off REM -- Define File Filter, i.e. files with extension .RBSet FindStrArgs=/E /C:".asp&q ...

  5. SpringBoot#Download

    _amaze! 如果不使用fastdfs等分布式的文件存储,有时候还是需要上传文件到web应用所在的服务器的磁盘上,下载文件.下面是一个小demo,关于如何用控制器进行上传和下载. - @PostMa ...

  6. Download file using libcurl in C/C++

    http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c #include <stdio.h&g ...

  7. httpClient download file(爬虫)

    package com.opensource.httpclient.bfs; import java.io.DataOutputStream; import java.io.File; import ...

  8. jQuery download file

    jQuery.download = function (url, method, p, c, e, i, o, goodsType, reciveUser, suplier) { jQuery('&l ...

  9. download file by python in google colab

    https://stackoverflow.com/questions/15352668/download-and-decompress-gzipped-file-in-memory You need ...

随机推荐

  1. 创建学生类 有姓名 学校 和年龄 覆盖toString() 1放到集合ArrayList 然后 2在第2个位置插入1个学生信息 3判断 刘德华这个学生是否存在 存在就打出来, 4输出全部学生信息 直接打印对象

    学生类 package com.lanxi.demo1; public class Student { //创建属性 姓名,学校,年龄 private String name; private Str ...

  2. git一些有用的命令

    更改本地和远程分支的名称 git branch -m old_branch new_branch # Rename branch locally 本地分支改名 git push origin :old ...

  3. 面向对象编程其实很简单--python面向对象(初级篇)

    出处:http://www.cnblogs.com/wupeiqi/ 概述 面向过程:根据业务逻辑从上到下写垒代码 函数式:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可 面向对象:对函 ...

  4. nodejs -- require , exports , module

    1. require , exports . -------------------------- 文件: 1) index.js //两种方式都可以: var forExports = requir ...

  5. js实现table表格相同内容按需合并

    uniteTdCells(tableId) { var table = document.getElementById(tableId); for (let i = 0; i < table.r ...

  6. ecmall 后台添加新菜单

    所谓的开发新菜单,其实是和开发模块相对比的,之前说的开发模块,是在应对较大的,或者较为复杂,又相对独立于其他功能的项目需求. 而开发菜单,就是简单的在后台增加一个一级菜单以及其子菜单,或者直接在现有的 ...

  7. 【软件安装与环境配置】TX2刷机过程

    前言 使用TX2板子之前需要进行刷机,一般都是按照官网教程的步骤刷机,无奈买不起的宝宝只有TX2核心板,其他外设自己搭建,所以只能重新制作镜像,使用该镜像进行刷机. 系统需求 1.Host Platf ...

  8. WEBBASE篇: 第八篇, JavaScript知识2

    JavaScript 2 一,数据类型: 作用: 约束了数据在内存中所占空间大小问题的: JS数据类型分类: 基本数据类型(值类型) (1) number 类型: 数字类型,可以表示32位的整数或64 ...

  9. 重启HA集群NameNode无缘无故挂掉

    重启HA集群后,两个NameNode无缘无故挂掉,查看日志时显示错误如下: 原因:journalnode的端口是8485,默认情况下是先NameNode启动后再启动journalnode,如果在Nam ...

  10. lombok安装

    今天学习spring boot 时候发现的lombok挺好用的,我这个使用的是spring boot 管理的版本,如果其他的可能需要你们自己去添加版本了,开发工具使用的是idea. maven: &l ...