Closed Ueland closed 10 years ago
@Ueland Thanks for login this ticket.
1) The FileItem is not supposed to be for multiple File
2) If you two @WebParam one like "@WebParam("file1") FileItem f1, @WebParam("file2") FiteItem f2" that should work right? Might not want you need, but I just want to make sure that this work.
3) The problem with supporting something like "@WebParam("files") List file" is that how does Snow can assume that the list if of Type file?
4) One option, would be to use Guava TypeToken, but add a little bit of complexity.
5) Or perhaps, a more elegant way is to have "@WebParam("files") FileItem[] files"
Actually, I think that 5. should be the way to go. Do you agree?
Yup, number five looks the beast, the main point here is to avoid having to have a @WebParam for each (for example) 50 files, A array would be a lot easier :)
Yes, make total sense. Let me work on 5.
On Wed, Nov 20, 2013 at 12:43 PM, Tor Henning Ueland < notifications@github.com> wrote:
Yup, number five looks the beast, the main point here is to avoid having to have a @WebParam for each (for example) 50 files, A array would be a lot easier :)
— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/issues/36#issuecomment-28929114 .
Jeremy Chone http://britesnow.com/ (415) 699 9912 Building Enterprise HTML5 Applications
Great!
Hi @Ueland can you refresh 2.0.3-SNAPSHOT and try the @WebParam("files")FileItem[] files
It should work and I made it that it actually work with any other primitive type as well. So, @WebParam("values")Long[] values, will also work if the http params values is a multi values (single value should also work, just have an array of 1).
I am still testing all the cases, but just wanted to give you an early drop.
Great, i forwared your tip to one of my co-developers which handles Snow in our project :)
Great, I am working on the other one about the header/closing of the http response. I just need to make sure I come with something convenient, elegant, and simple.
Jeremy,
On Thu, Dec 19, 2013 at 7:45 AM, Tor Henning Ueland < notifications@github.com> wrote:
Closed #36 https://github.com/BriteSnow/snow/issues/36.
— Reply to this email directly or view it on GitHubhttps://github.com/BriteSnow/snow/issues/36 .
Jeremy Chone http://britesnow.com/ (415) 699 9912 Building Enterprise HTML5 Applications
@Ueland Can you tell you developer to update Snow snapshot. I fixed an issue that might have broken the FileItem all together.
Done ;)
It appears to me that it is not possible to upload multiple files via one file upload box. (The HTML5 way)
Example:
HTML:
Annotation: @WebParam("files") FileItem files
Result: Uploading a single file works!
Uploading more than one file triggers: java.lang.ClassCastException: [Lorg.apache.commons.fileupload.FileItem; cannot be cast to org.apache.commons.fileupload.FileItem
Changing the annotation to: @WebParam("files") List file
Will then trigger: java.lang.IllegalArgumentException: com.britesnow.snow.web.param.annotation.WebParam is not a binding annotation. Please annotate it with @BindingAnnotation.