当我跑步时:
def zip() = Action {
val zipSource: Source[ByteString, _] =
StreamConverters
.asOutputStream()
.mapMaterializedValue(os => Future {
Thread.sleep(1)
println("*********** Start")
os.write("happy".getBytes("UTF8"))
println("*********** Sent")
os.close()
println("*********** OS closed")
})
Status(200).sendEntity(HttpEntity.Streamed(zipSource, None, Some("application/zip")))
}
我收到了打印声明:
[info] play.api.Play - Application started (Dev)
*********** Start
*********** Sent
*********** OS closed
但是,下载过程保持在“正在启动”状态,并且永远不会向前发展。我必须取消这个过程。有谁知道为什么?