如何使用 Google AppEngine 设置文件下载的文件名?我尝试设置Content-Disposition
,但 AppEngine 在生产中删除了该标题(在开发中工作)。
代码
resp.setContentType( "application/octet-stream" );
resp.setHeader( "Content-Disposition:", "attachment; filename=" + "\"" + fileName + "\"" );
开发标题
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="logs-2013-11-06-15-23-21.csv"
生产标头
HTTP/1.1 200 OK
Content-Type: application/octet-stream
X-AppEngine-Estimated-CPM-US-Dollars: $0.001434
X-AppEngine-Resource-Usage: ms=220 cpu_ms=224
Date: Wed, 06 Nov 2013 20:25:00 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Server: Google Frontend
Content-Length: 12713
Alternate-Protocol: 80:quic
参考
https://developers.google.com/appengine/docs/java/#Java_Responses https://code.google.com/p/googleappengine/issues/detail?id=10247