Aborting upload from a servlet to limit file size
I'd like to limit the size of the file that can be uploaded to an application. To achieve this, I'd like to abort the upload process from the server side when the size of the file being uploaded exceeds a limit. Is there a way to abort an upload process from the server side without waiting the HTTP request to finish? You can do something like this (using the Commons library): public class UploadFileServiceImpl extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/plain"); try { FileItem