- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 Playframework 2.5.0 应用程序必须提供临时创建的 zip 文件。我在/tmp 目录中创建并完成了 zip 文件,没有任何问题(我可以在这个地方打开它并提取其中包含的文件)。
但是发送给客户端的文件似乎被截断,无法打开。
String tempPath = "/tmp/" + label + ".zip";
File zipFile = new File(tempPath);
zipFile.deleteOnExit();
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
for (/* loops through files to zip */) {
InputStream is = methodToGetTheDocument();
ZipEntry zipEntry = new ZipEntry(document.getLabel());
zos.putNextEntry(zipEntry);
byte[] bytes = new byte[2048];
int count = is.read(bytes);
while (count > -1) {
zos.write(bytes, 0, count);
count = is.read(bytes);
}
is.close();
zos.closeEntry();
}
return ok(zipFile);
} catch (Exception e) {
return badRequest("Bad request");
} finally {
try {
zos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
我返回一个经典的 Result 对象...问题是什么?
最佳答案
您必须使用 zos.close()
“关闭”zip 文件在你面前return ok(zipFile)
关于java - Playframework 2.5.0 : Unable to serve server-side generated zip file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43071560/
Serv-U 密匙冲突,Serv-U无法启动处于离线状态解决方法 大家也许会遇到,在服务器上安装SERV-U时会出现密匙冲突提示。就算汉化时钩选破解也没有用。去网上找,很多密匙要么快过期了,要么没
How can I properly simulate a cloud function locally so that it has all data as when being invoked o
我一直在使用 Angular2 进行 Web 开发,并且一直在使用 Angular2 和 Firebase 来运行本地服务器。在使用Ionic创建服务器时,我一直没能找到类似于键入quit的命令,因此
我正在尝试使用 --serve-path 在该路径下为我的整个应用程序提供服务。例如,我希望我的路径是 localhost:4200/foobar 我使用 ng serve --serve-path=
目前正在学习Jekyll,一个建站框架,不知道bundle exec jekyll serve和jekyll serve有什么区别。两者的行为似乎相同。 最佳答案 两个字: bundle exec j
很快,我在 ng serve 上有一个 4.6MB 的应用。 当我这样做时: ng serve --prod 我得到 1MB 的文件大小。 但是,--prod 以某种方式使我的整个应用程序中断。 我向
您好,我正在尝试构建我的 React 应用程序,所以我做了 yarn build它创建了必要的文件夹,现在我正在尝试做 serve -s build它告诉我下面的错误 ** 我尝试通过 npm uni
我用过 ionic serve并得到以下回复,我没有三思而后选择 localhost .但是现在我想使用选项 1。Ionic 记住了我的选择,例如 ionic serve从不允许我再选择并使用 loc
将图像(例如)保存在内存中而不是从静态 Assets 中提供它们是否值得? 频繁请求的静态资源会保留在内存中吗? 谁能告诉我性能影响? 最佳答案 除非您以每秒数千的速度为用户提供服务,否则我怀疑它会产
我的理解是,我应该能够从 Google 的 AI Hub 中获取 TensorFlow 模型,将其部署到 TensorFlow Serving 并使用它通过使用 curl 的 REST 请求发布图像来
我正在使用 Angular 7,我想知道是否 ng serve --prod 与相同 ng serve -c production 在文档中找不到,所以任何帮助将不胜感激 最佳答案 这里有一些文档:h
使用 struts.serve.static=true 和 struts,serve.static.browserCache=false 标记的浏览器缓存不起作用我有一个要求,即使用户注销并单击后退按
它曾经可以工作,但是当我重新启动我的电脑时,它就不再工作了。 nodejs目录设置在Path环境变量中。我尝试重新安装 nodejs。我还尝试卸载 @vue 文件夹,以管理员身份运行我的 git ba
互联网的应用已经波及了我们的方方面面,那么加快对于网络的学习也是必要的。所以今天我们来介绍一下Serv-U的FTP服务器的架构。本文将结合Serv-U这一功能强大,界面友好,易学易用的FTP服务器端
注意:上面是FTP服务器端建立FTP用户的教程,建立FTP用户我们需要通过FTP客户端连接服务器的FTP,从而使用FTP上传文件到服务器或下载
前言: 大家应该都还没有忘记三年前在Serv-U5.004版的之前所有版本的"Serv-U FTPMDTM命令缓冲区溢出"与"Serv-U FTP服务器LIST命令超长
比起IIS来,Serv-U的管理功能强大得多,而且设置也很方便。需要特别注意的是每进行任何一次设置或改动,都要点击界面左上角工具条的“保存”按钮才能生效。 1.账户管理 Serv-U对账户的管理
Serv-U FTP Server是一种被广泛运用的FTP服务器端软件,可以设定多个FTP服务器、限定登录用户的权限、登录主目录及空间大小等,功能非常完备.具有非常完备的安全特性,支持SSl FT
我是 Angular 的新手,我克隆了一个 repo (angular-slider)。我的问题是,当我输入控制台 grunt serve 时,它显示警告:找不到任务“服务”。使用 --force
我正在使用运行 Node v8.11.3 的 Gatsby v1.1.52。 当我跑 gatsby serve我收到一条消息,提示我有一个 UPDATE AVAILABLE: The latest v
我是一名优秀的程序员,十分优秀!