downLoad
String root= ServletActionContext.getServletContext().getRealPath(File.separator).replace("\\", File.separator);
String fileName = "download.text";
File file = new File(root + fileName);
in = new FileInputStream(file);
// 设置响应正文的MIME类型
response.setContentType("Content-Disposition;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;" + " filename=\""+ URLEncoder.encode(fileName, "UTF-8") + "\"");
// 把本地文件发送给客户端
out = response.getOutputStream();
int byteRead = 0;
byte[] buffer = new byte[512];
while ((byteRead = in.read(buffer)) != -1)
{
out.write(buffer, 0, byteRead);
}
in.close();
out.close();
downLoad的更多相关文章
- csharp: Download SVN source
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Unable to download data from http://ruby.taobao.org/ & don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
安装cocoapods,记录两个问题! 1.镜像已经替换成了 http://ruby.taobao.org/, 还是不能不能安装cocoapods, 报错:Unable to download dat ...
- MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL
MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL 是因为目标板的芯片处于休眠 ...
- kailli linux download
https://www.offensive-security.com/kali-linux-arm-images/ Courses Certifications Online Labs Penetra ...
- Download Excel file with Angular
源码连接(编写中) 用Angular下载后台返回的Excel文件,用Blob实现,引用FileSaver.js 后台C#代码: [WebMethod] public static byte[] Cal ...
- http://www.microsoft.com/en-pk/download/details.aspx?id=40762
http://www.microsoft.com/en-pk/download/details.aspx?id=40762
- [已解决]从微软合作伙伴资源和MSDN下载系统和软件Microsoft download Manager无效
有个itellyou,更新了所有MSDN的软件包.如果自己有微软的注册账户,还是从微软官网下载比较好.而且对自己账户里的系统和itellyou里的做了对比.发现SHA1码不相同,估计官方分配的序列号也 ...
- Error:Flash Download Failed-"Cortex-M3"
Error:Flash Download Failed-"Cortex-M3"出现一般有两种情况: 1.SWD模式下,Debug菜单中,Reset菜单选项(Autodetect/H ...
- cosbench read异常解决办法。 Unable to verify integrity of data download. Client calculated content hash didn't match hash calculated by Amazon S3. The data may be corrupt.
问题:cosbench read测试failed 报错如下 Cosbench v0.4.2.c4 against Ceph (Hammer) / radosgw / HAproxy's HTTP en ...
- Internet Download Manager 6.27.1 中文特别版(IDM)
软件介绍: 软件名称:Internet Download Manager(IDM) 软件大小:5.09M软件语言:简体中文 软件官网:http://www.internetdownloadmanage ...
随机推荐
- 分页传参数的两种形式,url正则 ?id=1
目的: 打开http://127.0.0.1:8000/home 点击查看详情转到 http://127.0.0.1:8000/detail-1-1.html实现查看具体信息 一,利用url路由 ...
- Android批量验证渠道、版本号(Linux版)
功能:可校验单个或目录下所有apk文件的渠道号.版本号(Linux版本)使用说明:1.copy需要校验的apk文件到VerifyChannelVersion目录下2../VerifyChannelVe ...
- solr6.4.1搜索引擎(5)使用zookeeper3.4.9分布式集群
本文讲的是如何使用zookeeper将solr分布式部署,也可以理解为tomcat分布式部署. 为什么要使用zookeeper,请参考文章<Solr的SolrCloud与Master-slave ...
- 第二次作业——分布式版本控制系统Git的安装与使用
作业要求来自:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/2097 远程仓库地址是:https://github.com/sheep ...
- 转wave 文件解析
转 1 WAVE 文件格式分析 WAVE 文件作为多媒体中使用的声音波形文件格式之一,它是以RIFF(Resource Interchange File Format)格式为标准的.每个WAVE文件的 ...
- python-web自动化-元素定位
# -*- coding:utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By # ...
- [java,2017-05-16] java中清空StringBuffer的方法以及耗费时间比较
java中清空StringBuffer的方法,我能想到的有4种: 1. buffer.setLength(0); 设置长度为0 2. buffer.delete(0, buffer.length() ...
- python3笔记<一>基础语法
随着AI人工智能的兴起,网络安全的普及,不论是网络安全工程师还是AI人工智能工程师,都选择了Python.(所以本菜也来开始上手Python) Python作为当下流行的脚本语言,其能力不言而喻,跨平 ...
- Dubbo基本原理机制
分布式服务框架: –高性能和透明化的RPC远程服务调用方案 –SOA服务治理方案 -Apache MINA 框架基于Reactor模型通信框架,基于tcp长连接 Dubbo缺省协议采用单一长连接和 ...
- android 开发 Intent使用技巧点
判断Intent是否为null: if (intent.resolveActivity(getPackageManager())!=null) { //判断Intent是否为null // Inten ...