2
我使用Jetty 9的實現HttpServletRequest#getPart(name)
,它似乎在繼續之前熱切地處理整個請求(或至少Part
問題),即使產生的Part
公開了一種getInputStream()
方法。如何懶惰地使用HttpServletRequest#getPart(name)
getPart
是否有立即返回的方法,並且請求流式傳輸到結果Part
的InputStream
?
僅供參考,這裏是從我的Servlet
執行相關片段:
override def doPost(req: HttpServletRequest, res: HttpServletResponse) {
println("ABOUT TO GET PART") // this happens immediately
val file = req.getPart("file")
println("GOT PART") // it takes a long time to get here if the upload is large