b*i
2 楼
我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
问为什么?如何改进?谢谢
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException ,IOException {
res.setContentType("audio/mpeg3");
OutputStream os = res.getOutputStream();
res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
";");
res.setContentLength(1000000);
FileService fileService = FileServiceFactory.getFileService();
boolean lockForRead = false;
String filename = "/gs/" + BUCKETNAME + "/" + FILENAME;
AppEngineFile readableFile = new AppEngineFile(filename);
try{
FileReadChannel readChannel = fileService.openReadChannel(readableFile
, lockForRead);
InputStream is = Channels.newInputStream(readChannel);
int BUFF_SIZE = 1024;
byte[] buffer = new byte[BUFF_SIZE];
try {
do {
int byteCount = is.read(buffer);
if (byteCount == -1)
break;
os.write(buffer, 0, byteCount);
os.flush();
} while (true);
} catch (Exception excp) {
} finally {
os.close();
is.close();
}
readChannel.close();
} catch(Exception e){
}
}
如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
问为什么?如何改进?谢谢
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException ,IOException {
res.setContentType("audio/mpeg3");
OutputStream os = res.getOutputStream();
res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
";");
res.setContentLength(1000000);
FileService fileService = FileServiceFactory.getFileService();
boolean lockForRead = false;
String filename = "/gs/" + BUCKETNAME + "/" + FILENAME;
AppEngineFile readableFile = new AppEngineFile(filename);
try{
FileReadChannel readChannel = fileService.openReadChannel(readableFile
, lockForRead);
InputStream is = Channels.newInputStream(readChannel);
int BUFF_SIZE = 1024;
byte[] buffer = new byte[BUFF_SIZE];
try {
do {
int byteCount = is.read(buffer);
if (byteCount == -1)
break;
os.write(buffer, 0, byteCount);
os.flush();
} while (true);
} catch (Exception excp) {
} finally {
os.close();
is.close();
}
readChannel.close();
} catch(Exception e){
}
}
r*t
3 楼
My friend is looking for a Postdoc. He is a very nice guy. this is a good
opportunity.
The Illinois Sustainable Technology Center at University of Illinois Urbana-
Champaign is seeking one full time postdoctoral research associate to
conduct laboratory research, model simulation, and field studies concerning
the enviromental fate and transport of steroid hormones and verterinary
antibiotics derived from animal farms.
Responsibilities: The post-doctoral researcher will work with a team of
scientists to determine hormones and antibiotics in a variety of complex
matrices, investigate the fate and transport of manure-associated steroid
hormones and veterinary antibiotics derived from dairy and beef farms,
develop/utilize models to demonstrate the transport processes of these
contaminants in the environment, and monitor the occurrence of steroid
hormones and veterinary antibiotics in water bodies surrounding dairy and
beef farms. He/she will be actively engaged in most aspects of the research
and will coordinate daily research activities, data management, and multi-
criteria systems analysis, in conjunction with the project management team.
Qualifications: Applicants must have a Ph.D. in chemistry, environmental
engineering, chemical engineering, soil, hydrology or related fields.
Experience with LC-MS analysis and column experiments and model simulation
is preferred.
The position is funded through a USDA/CSREES’s grant with a salary of >$43,
000 plus benefits. Applicants should send a letter of application, C.V., and
the contact information of three professional references (including names,
addresses, phone numbers and e-mail addresses) to Dr. Wei Zheng, llinois
Sustainable Technology Center, 1 E. Hazelwood Drive, Champaign, IL 61820, or
e-mail to w****[email protected] Applicants materials will be accepted
immediately and until the position is filled.
opportunity.
The Illinois Sustainable Technology Center at University of Illinois Urbana-
Champaign is seeking one full time postdoctoral research associate to
conduct laboratory research, model simulation, and field studies concerning
the enviromental fate and transport of steroid hormones and verterinary
antibiotics derived from animal farms.
Responsibilities: The post-doctoral researcher will work with a team of
scientists to determine hormones and antibiotics in a variety of complex
matrices, investigate the fate and transport of manure-associated steroid
hormones and veterinary antibiotics derived from dairy and beef farms,
develop/utilize models to demonstrate the transport processes of these
contaminants in the environment, and monitor the occurrence of steroid
hormones and veterinary antibiotics in water bodies surrounding dairy and
beef farms. He/she will be actively engaged in most aspects of the research
and will coordinate daily research activities, data management, and multi-
criteria systems analysis, in conjunction with the project management team.
Qualifications: Applicants must have a Ph.D. in chemistry, environmental
engineering, chemical engineering, soil, hydrology or related fields.
Experience with LC-MS analysis and column experiments and model simulation
is preferred.
The position is funded through a USDA/CSREES’s grant with a salary of >$43,
000 plus benefits. Applicants should send a letter of application, C.V., and
the contact information of three professional references (including names,
addresses, phone numbers and e-mail addresses) to Dr. Wei Zheng, llinois
Sustainable Technology Center, 1 E. Hazelwood Drive, Champaign, IL 61820, or
e-mail to w****[email protected] Applicants materials will be accepted
immediately and until the position is filled.
S*w
4 楼
猪撞树上了
b*i
5 楼
补充一点,正确的response是
HTTP/1.1 200 OK
Date: Mon, 27 Feb 2012 04:25:54 GMT
Server: Apache
Last-Modified: Sun, 27 Nov 2011 05:05:40 GMT
ETag: "1530c7-1a1ac3-442b0566f0745"
Accept-Ranges: bytes
Content-Length: 1055427
Cache-Control: max-age=1209600
Expires: Mon, 12 Mar 2012 04:25:54 GMT
Content-Type: audio/mpeg
我是否要加上 setHeader来设定这些?到底是什么使得原来的goDaddy上面的http://xxx.com/a.mp3可以立即播放,而我的通过servlet的要下载后?我把 res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
删掉也不行。
mp3
【在 b***i 的大作中提到】
: 我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
: 如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
: 下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
: outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
: 问为什么?如何改进?谢谢
: public void doGet(HttpServletRequest req, HttpServletResponse res) throws
: ServletException ,IOException {
: res.setContentType("audio/mpeg3");
: OutputStream os = res.getOutputStream();
: res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
HTTP/1.1 200 OK
Date: Mon, 27 Feb 2012 04:25:54 GMT
Server: Apache
Last-Modified: Sun, 27 Nov 2011 05:05:40 GMT
ETag: "1530c7-1a1ac3-442b0566f0745"
Accept-Ranges: bytes
Content-Length: 1055427
Cache-Control: max-age=1209600
Expires: Mon, 12 Mar 2012 04:25:54 GMT
Content-Type: audio/mpeg
我是否要加上 setHeader来设定这些?到底是什么使得原来的goDaddy上面的http://xxx.com/a.mp3可以立即播放,而我的通过servlet的要下载后?我把 res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
删掉也不行。
mp3
【在 b***i 的大作中提到】
: 我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
: 如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
: 下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
: outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
: 问为什么?如何改进?谢谢
: public void doGet(HttpServletRequest req, HttpServletResponse res) throws
: ServletException ,IOException {
: res.setContentType("audio/mpeg3");
: OutputStream os = res.getOutputStream();
: res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
b*i
7 楼
我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
问为什么?如何改进?谢谢
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException ,IOException {
res.setContentType("audio/mpeg3");
OutputStream os = res.getOutputStream();
res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
";");
res.setContentLength(1000000);
FileService fileService = FileServiceFactory.getFileService();
boolean lockForRead = false;
String filename = "/gs/" + BUCKETNAME + "/" + FILENAME;
AppEngineFile readableFile = new AppEngineFile(filename);
try{
FileReadChannel readChannel = fileService.openReadChannel(readableFile
, lockForRead);
InputStream is = Channels.newInputStream(readChannel);
int BUFF_SIZE = 1024;
byte[] buffer = new byte[BUFF_SIZE];
try {
do {
int byteCount = is.read(buffer);
if (byteCount == -1)
break;
os.write(buffer, 0, byteCount);
os.flush();
} while (true);
} catch (Exception excp) {
} finally {
os.close();
is.close();
}
readChannel.close();
} catch(Exception e){
}
}
如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
问为什么?如何改进?谢谢
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException ,IOException {
res.setContentType("audio/mpeg3");
OutputStream os = res.getOutputStream();
res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
";");
res.setContentLength(1000000);
FileService fileService = FileServiceFactory.getFileService();
boolean lockForRead = false;
String filename = "/gs/" + BUCKETNAME + "/" + FILENAME;
AppEngineFile readableFile = new AppEngineFile(filename);
try{
FileReadChannel readChannel = fileService.openReadChannel(readableFile
, lockForRead);
InputStream is = Channels.newInputStream(readChannel);
int BUFF_SIZE = 1024;
byte[] buffer = new byte[BUFF_SIZE];
try {
do {
int byteCount = is.read(buffer);
if (byteCount == -1)
break;
os.write(buffer, 0, byteCount);
os.flush();
} while (true);
} catch (Exception excp) {
} finally {
os.close();
is.close();
}
readChannel.close();
} catch(Exception e){
}
}
b*i
8 楼
补充一点,正确的response是
HTTP/1.1 200 OK
Date: Mon, 27 Feb 2012 04:25:54 GMT
Server: Apache
Last-Modified: Sun, 27 Nov 2011 05:05:40 GMT
ETag: "1530c7-1a1ac3-442b0566f0745"
Accept-Ranges: bytes
Content-Length: 1055427
Cache-Control: max-age=1209600
Expires: Mon, 12 Mar 2012 04:25:54 GMT
Content-Type: audio/mpeg
我是否要加上 setHeader来设定这些?到底是什么使得原来的goDaddy上面的http://xxx.com/a.mp3可以立即播放,而我的通过servlet的要下载后?我把 res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
删掉也不行。
mp3
【在 b***i 的大作中提到】
: 我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
: 如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
: 下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
: outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
: 问为什么?如何改进?谢谢
: public void doGet(HttpServletRequest req, HttpServletResponse res) throws
: ServletException ,IOException {
: res.setContentType("audio/mpeg3");
: OutputStream os = res.getOutputStream();
: res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
HTTP/1.1 200 OK
Date: Mon, 27 Feb 2012 04:25:54 GMT
Server: Apache
Last-Modified: Sun, 27 Nov 2011 05:05:40 GMT
ETag: "1530c7-1a1ac3-442b0566f0745"
Accept-Ranges: bytes
Content-Length: 1055427
Cache-Control: max-age=1209600
Expires: Mon, 12 Mar 2012 04:25:54 GMT
Content-Type: audio/mpeg
我是否要加上 setHeader来设定这些?到底是什么使得原来的goDaddy上面的http://xxx.com/a.mp3可以立即播放,而我的通过servlet的要下载后?我把 res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
删掉也不行。
mp3
【在 b***i 的大作中提到】
: 我说的stream,就是把链接放入浏览器,就立即开始播放,一边播放,一边下载。
: 如果我用godaddy的服务器,放入一个静态文件,是可以这样的。
: 下面是我放入google app engine的servlet, 和一般servlet略为不同就是input/
: outputstream有些不同,但原则都一样,结果是浏览器等待文件下载完毕后才打开,请
: 问为什么?如何改进?谢谢
: public void doGet(HttpServletRequest req, HttpServletResponse res) throws
: ServletException ,IOException {
: res.setContentType("audio/mpeg3");
: OutputStream os = res.getOutputStream();
: res.setHeader("Content-Disposition", "attachment; filename="" + "a.mp3
m*k
9 楼
chunk?
App server setting?
This post seems to have something:
http://stackoverflow.com/questions/685271/using-servletoutputst
App server setting?
This post seems to have something:
http://stackoverflow.com/questions/685271/using-servletoutputst
相关阅读
购买欧美化工,环保方面的技术,专业研究院(所)及收购化工,环保方面的中小型公司Amex Blue Cash preferred 6%现金回扣+$150bonus超市专用信用卡Potentiostat比较 (转载)有在克瓦纳 kvaerner 上班的吗【国内】500强前三美资石油巨头招聘Research Scientist求助:化工在读研究生怎么跟老板提换组的事情?马上就要签合同了,大家帮着看看这样的合同条件合理吗(注化工制药行业) 标 题: 马上就要签合同了,大家帮着看看这样的合同条件合理吗(注化工制药行业)会这个软件竟然可以拿到20万美金年薪,我和小伙伴们都惊呆了!受压反应器为哈设计的精馏塔大部分都不准确?哪位好心人帮忙查几篇文献。在Desalination and Water treatment杂志上。求氨法脱硫脱销一体化用的催化剂替代品中秋快乐!请各位前辈工作推荐:化学专业高分子和胶体材料背景Capital one 360 checking 免费送50刀,赶紧申请求审稿!!陶瓷氧化物材料,多谢OPT挂靠延期受压反应器请各位前辈工作推荐:化学专业高分子和胶体材料背景phd请问exposure limits的单位mg/m3是什么意思?