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 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 我说的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 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 我说的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 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 我说的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 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 我说的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
相关阅读
第15届华美化学与化工学会Call for article庆独立日,Chase 信用卡狂送$500现金或$625机票任你选请问美国的油漆真的很安全吗?对孕妇而言版上有没有人做超导选矿设备的?7MP下甲醇乙醇多少度就会发生脱水? (转载)银行信用卡晕倒奥巴马,每人送$500,比退税牛求书《化工原理》 版本无所谓Manager or Director of Engineering-Beijing是当初出茅庐的30多岁导师的大弟子还是当泰山北斗级的60多岁大牛的关门弟子?免费$500或2次往返机票offer Sapphire Preferred Card庆独立日,Chase 信用卡狂送$500现金或$625机票任你选Postdoc position on Nano Thin Film research (转载)求paper跟recruiter电面时是问你什么答什么还是你自己可以扩展一些 (转载)化工版新春饺子中国上海联合利华招聘以下化学,物理,材料,食物,生物海外学者学化工的乃们伤不起!!!!(转)请教:化学PhD想找化工方面的postdocMaster选学校求建议