java - Apache Commons Fileupload / Tomcat cant cope with out.flush() -


Does anyone know that if you are trying to flush the servlet output stream, then the Apache Commons FileUpload Exceptions thrown?

  FileUploadException: The process of multipart / form-data request failed. The stream ended unexpectedly  

Actually I have a code that is rife through every file uploaded using the Apache Commons file upload, and then out .flush () file some data about each. I.e.:

  file item factory factory = new disk file itemfactor (); Servicelet file upload upload = new servile file upload (factory); & Lt; FileItem & gt; Item = upload. Similarities (request); (File item field: item) {if.! Field.isFormField () & amp; amp; field.getName () Length ()> 0 & amp; amp; field.getName () .GetSize ()> ; 0) {ArticleImport Assistant = New Article Import (New ArticleImportResponder (User, Outside)); // It uses outside the helper object Flush () to provide feedback to the user. Helper.process (field.getInputStream (), user); There is no problem in Apache Tomcat 6.0.20, but it occurs in earlier versions.   

Unfortunately this is a known bug, besides you Nothing can do, except to ensure that you have at least 6.0.20.

You can find out which version of Tomcat is running and its use is to determine that you can use out.flush () using the following calls: < / P>

  javax.servlet.ServletContext .getServerInfo ();  

Comments

Popular posts from this blog

MySql variables and php -

php - Laravel - Overriding a resource route into a different route filter group -

url rewriting - How to implement the returnurl like SO in PHP? -