]> source.dussan.org Git - vaadin-framework.git/commit
Support uploading files larger 2GB via drag and drop and file input (#11947).
authorFabian Lange <lange.fabian@gmail.com>
Wed, 12 Jun 2013 19:21:31 +0000 (21:21 +0200)
committerFabian Lange <lange.fabian@gmail.com>
Mon, 8 Jul 2013 13:05:36 +0000 (15:05 +0200)
commit68be95e48405be0e5d54b3d8ddb66de454fcbfed
tree1e66059faac624bb100f8a836761e6c0fb708965
parentcd9bd20c52423e9970d1945c374e4cbefff82569
Support uploading files larger 2GB via drag and drop and file input (#11947).

Vaadin mostly just passes through the value from the Javascript File object
on drag and drop. As per specification (http://www.w3.org/TR/file-upload/#blob)
the size value can be "long". The size attribute of Html5File was already long,
but this patch makes sure long values actually are transported correctly from
the client side Transferable. Additionally, the file upload handling in
FileUploadHandler was determining the length of the upload via the Servlet Spec
getContentLength method of the request. However the spec was written at a time
where 2GB were unthinkable. Luckily containers return this value by querying
the Content-Length header, which can transport values of "long". So instead of
using the Servlet Spec method, FileUploadHandler evaluates the header itself.
AbstractStreamingEvent already was supporting "long" values. For Drag&Drop,
the file size needs to be serialized as double, because long is not supported
in JSNI.

Change-Id: I606fca7430c65c20144793fa011cb2f6ee3a0415
client/src/com/vaadin/client/ui/dd/VHtml5File.java
server/src/com/vaadin/server/communication/FileUploadHandler.java
server/src/com/vaadin/ui/DragAndDropWrapper.java