....For every file it calls the UploadedFileConverter, this is the same for the ajax uploader and a form with multiple upload files.
On 24 November 2016 at 14:08, Lukasz Lenart <lukaszlen...@apache.org> wrote: > That shouldn't matter but I think how can I test this behaviour. > > 2016-11-24 15:03 GMT+01:00 Greg Huber <gregh3...@gmail.com>: > > Sorry, forgot to add this is not on the app engine! Was only testing the > > plugin functionality ie the filter and the listener. I assume the array > > comes from when running the webapp on the app engine? > > > > > > > > On 24 November 2016 at 13:26, Lukasz Lenart <lukaszlen...@apache.org> > wrote: > > > >> Hm... this can be an internal conversion of collection containing > >> uploaded files. Does your ajax upload allow upload multiple files at > >> once? > >> > >> 2016-11-24 14:18 GMT+01:00 Lukasz Lenart <lukaszlen...@apache.org>: > >> > How is that possible? I meant, parameters should always be passed as > >> > arrays, that's how HttpServletRequest works. Do you use custom > >> > implementation of MultiPartRequest? Could you share your upload logic, > >> > action and JSP/JavaScript? > >> > > >> > That's why JakartaMultiPartRequest (and other implementations as well) > >> > always creates an array, even if only one file is uploaded: > >> > https://github.com/lukaszlenart/struts/blob/WW- > >> 4717/core/src/main/java/org/apache/struts2/dispatcher/multipart/ > >> JakartaMultiPartRequest.java#L110-L118 > >> > > >> > > >> > Regards > >> > -- > >> > Łukasz > >> > + 48 606 323 122 http://www.lenart.org.pl/ > >> > > >> > 2016-11-24 12:13 GMT+01:00 Greg Huber <gregh3...@gmail.com>: > >> >> Seems to be this line in UploadedFileConverter: > >> >> > >> >> if (value.getClass().isArray() && Array.getLength(value) == 1) { > >> >> > >> >> where value == > >> >> org.apache.struts2.dispatcher.multipart.StrutsUploadedFile@62e25d8 > >> >> > >> >> and is not an array. > >> >> > >> >> this works: > >> >> > >> >> Object obj = null; > >> >> if (value.getClass().isArray() && Array.getLength(value) > == > >> 1) { > >> >> obj = Array.get(value, 0); > >> >> } else { > >> >> obj = value; > >> >> } > >> >> if (obj instanceof UploadedFile) { > >> >> UploadedFile file = (UploadedFile) obj; > >> >> if (file.getContent() instanceof File) { > >> >> return file.getContent(); > >> >> } > >> >> return new File(file.getAbsolutePath()); > >> >> } > >> >> > >> >> This works for both my ajax and normal upload. > >> >> > >> >> On 23 November 2016 at 12:56, Lukasz Lenart <lukaszlen...@apache.org > > > >> wrote: > >> >> > >> >>> Could someone tag that PR with :+1:? > >> >>> > >> >>> 2016-11-22 20:41 GMT+01:00 Lukasz Lenart <lukaszlen...@apache.org>: > >> >>> > All is good :) I have refactored the file upload logic a bit, > cleaned > >> >>> > up and fixed some issues with wrong message keys. Also I added > >> >>> > dedicated converter to keep support for java.io.File so there is > no > >> >>> > need for migration :) > >> >>> > > >> >>> > I've also developed a small GAE plugin which is using the > mentioned > >> >>> > changes (that's why build cannot pass as a Struts SNAPSHOT is > wrong > >> >>> > ;-)), tested it locally and everything works as expected :D > >> >>> > https://github.com/lukaszlenart/struts2-gea-plugin > >> >>> > > >> >>> > Can you take a look on that PR? > >> >>> > > >> >>> > > >> >>> > Thanks in advance > >> >>> > -- > >> >>> > Łukasz > >> >>> > + 48 606 323 122 http://www.lenart.org.pl/ > >> >>> > > >> >>> > 2016-11-22 9:44 GMT+01:00 Lukasz Lenart <lukaszlen...@apache.org > >: > >> >>> >> Done, thanks Aaron :) Now I must test this solution with Google > >> >>> AppEngine ;-) > >> >>> >> > >> >>> >> 2016-11-22 7:49 GMT+01:00 Lukasz Lenart <lukaszlen...@apache.org > >: > >> >>> >>> 2016-11-21 20:12 GMT+01:00 Aaron Johnson < > johnson.aar...@gmail.com > >> >: > >> >>> >>>> Is it possible to have a converter from UploadedFile to File? > The > >> >>> >>>> UploadedFile has a getContent() method that returns the File > >> object. > >> >>> >>> > >> >>> >>> Hm... it would be possible to add a converter, that should work > :) > >> >>> >>> > >> >>> >>> > >> >>> >>> Regards > >> >>> >>> -- > >> >>> >>> Łukasz > >> >>> >>> + 48 606 323 122 http://www.lenart.org.pl/ > >> >>> > >> >>> ------------------------------------------------------------ > --------- > >> >>> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > >> >>> For additional commands, e-mail: dev-h...@struts.apache.org > >> >>> > >> >>> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > >> For additional commands, e-mail: dev-h...@struts.apache.org > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org > >