I'd like to force connection abort in servlet, without using HTTP header.
Problem
- I have a servlet that generate a file download, which pipe some bytes to OutputStream
- The browser read the header, with UNKNOWN-FILE-SIZE
- The browser downloading byte streams.
- Servlet could like to abort the download in the middle.
- Let the browser abort and delete the downloaded file, and mark it as failed
Facts
- The header is already sent.
- The file-size is unknown until complete, cannot use Content-Length:
- There is no .abort() or .disconnect() in HttpServlet{Request,Response}
- The servlet has to be generic, without hacking servlet container specific API for Socket stealing
- The contains and size are dynamic, which could be heavy for generate file(or make sure everything are in RAM) before download
from User Dennis Cheung - Stack Overflow http://stackoverflow.com/questions/30589597/how-to-drop-abort-http-connection-from-servlet
via IFTTT
沒有留言:
發佈留言