Re: Fileupload on JakartaEE

2023-02-28 Thread Greg Huber
..probably right, but its always good to have a backup to dependencies. On 28/02/2023 07:29, Lukasz Lenart wrote: I think this is not the way to handle the file upload with Servlet API 3.1 - we must wait on upgrading commons-fileupload to version supporting Jakarta API (btw. Tomcat is using it r

Re: Fileupload on JakartaEE

2023-02-27 Thread Lukasz Lenart
I think this is not the way to handle the file upload with Servlet API 3.1 - we must wait on upgrading commons-fileupload to version supporting Jakarta API (btw. Tomcat is using it right now). I will try to help make this happen :) Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ nie

Re: Fileupload on JakartaEE

2023-01-01 Thread Greg Huber
I rechecked tomcats work folder to see what the parts are, there are no files with zero size, only the the hidden fields, submit button (Upload) and the image. The two extra parts could be these as they have the name uploadedFiles and match FieldName=uploadedFiles   id="uploadFiles_uploaded

Re: Fileupload on JakartaEE

2023-01-01 Thread Lukasz Lenart
sob., 31 gru 2022 o 08:18 Greg Huber napisał(a): > Seems there is more going on, as without it there are two extra parts > with no StoreLocation. "Without it" - what does that mean? > name=, StoreLocation=null, size=0 bytes, isFormField=false, > FieldName=uploadedFiles > > name=myimage.jpg, > St

Re: Fileupload on JakartaEE

2022-12-30 Thread Greg Huber
Seems there is more going on, as without it there are two extra parts with no StoreLocation. name=, StoreLocation=null, size=0 bytes, isFormField=false, FieldName=uploadedFiles name=myimage.jpg, StoreLocation=/home/dev/git/myapp/myapp/work/upload_0f8323e4_9dd9_4972_8305_6b7c31911f47_0033

Re: Fileupload on JakartaEE

2022-12-30 Thread Lukasz Lenart
I have made this new MultiPartParser optional for now and stick to the Commons Fileupload for now. I will document how to use the new Servlet API 3.1 based parser and it will be default98 since Struts 7.0.0 Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ ---

Re: Fileupload on JakartaEE

2022-12-30 Thread Lukasz Lenart
pt., 30 gru 2022 o 10:06 Greg Huber napisał(a): > > Also need an extra check || "".equals(part.getSubmittedFileName() > > for (Part part : parts) { > if (part.getSubmittedFileName() == null || > "".equals(part.getSubmittedFileName()) ) { // normal field Empty getSubmittedFileName() m

Re: Fileupload on JakartaEE

2022-12-30 Thread Greg Huber
Also need an extra check || "".equals(part.getSubmittedFileName() for (Part part : parts) {     if (part.getSubmittedFileName() == null || "".equals(part.getSubmittedFileName()) ) { // normal field    LOG.error("Ignoring a normal form field: {}", part.getName());  

Re: Fileupload on JakartaEE

2022-12-30 Thread Lukasz Lenart
pt., 30 gru 2022 o 09:39 Greg Huber napisał(a): > Is it possible to use the original temp file that tomcat creates rather > than creating another one? If "struts.multipart.saveDir" is not provided (or empty), Struts will use "javax.servlet.context.tempdir" which should be defined in servlet conte

Re: Fileupload on JakartaEE

2022-12-30 Thread Greg Huber
With the correct servlet mapping (other email) it kind of works, but the file has zero size. in ServletMultiPartRequest.extractFile(Part part, String saveDir) it creates an empty temporary file (line 134) which it returns: File tempFile = File.createTempFile(prefix + "_", suffix, new File(sav

Re: Fileupload on JakartaEE

2022-12-30 Thread Lukasz Lenart
czw., 29 gru 2022 o 17:40 Greg Huber napisał(a): > Does not seem to call the servlet, only a 404. I use the > StrutsPrepareAndExecuteFilter. With the filter mapping, how does it use the > servlet mapping? The basic idea is that when the filter detects if this a fileupload request and the new

Re: Fileupload on JakartaEE

2022-12-29 Thread Greg Huber
      fileUploadServlet /user/resources.action   makes it work, but ends up with an empty file called embeddable53b33ea6a4fb4bb1957d35fa60af338c.jpg. Will debug some more.😁 On 29/12/2022 12:56, Lukasz Lenart wrote: czw., 29 gru 2022 o 13:34 Greg Huber napisał(a): I have now set struts.

Re: Fileupload on JakartaEE

2022-12-29 Thread Greg Huber
struts.multipart.parser=servlet struts2 url-pattern>*.action fileUploadServlet /user/resources* Does not seem to call the servlet, only a 404. I use the StrutsPrepareAndExecuteFilter. With the filter mapping, how does it use the servlet mapping? boolean isMultipartRe

Re: Fileupload on JakartaEE

2022-12-29 Thread Lukasz Lenart
czw., 29 gru 2022 o 13:34 Greg Huber napisał(a): > > I have now set > > struts.multipart.parser=org.apache.struts2.dispatcher.multipart.ServletMultiPartRequest this must be: struts.multipart.parser=servlet (I will document this latter) > > fileUploadServlet > org.apache.struts2.dispat

Re: Fileupload on JakartaEE

2022-12-29 Thread Greg Huber
I have now set struts.multipart.parser=org.apache.struts2.dispatcher.multipart.ServletMultiPartRequest     fileUploadServlet org.apache.struts2.dispatcher.servlet.FileUploadServlet         fileUploadServlet     /fileupload/*     /tags/ui/* # I get in FileUploadSupport.

Re: Fileupload on JakartaEE

2022-12-29 Thread Lukasz Lenart
czw., 29 gru 2022 o 11:55 Greg Huber napisał(a): > > I made no changes just used the branch as is. I tried deleting the > commons jar to make sure it was using the new code but my app won't > start without it. Cool, it means I didn't break any existing configuration :D Did you change the value

Re: Fileupload on JakartaEE

2022-12-29 Thread Greg Huber
I made no changes just used the branch as is.  I tried deleting the commons jar to make sure it was using the new code but my app won't start without it. ..If I add a breakpoint on FileUploadSupport isFileUploadRequest(..) it stops so I assume its being used. On 29/12/2022 10:44, Lukasz Lena

Re: Fileupload on JakartaEE

2022-12-29 Thread Lukasz Lenart
czw., 29 gru 2022 o 11:40 Greg Huber napisał(a): > WW-5273-servlet-upload branch works on both my ajax and forms based upload. Great to hear that! Did you have any problem with configuring that additional FileUploadServlet which is needed by Servlet API 3.1? > (although commons-fileupload-1.4.ja

Re: Fileupload on JakartaEE

2022-12-29 Thread Greg Huber
WW-5273-servlet-upload branch works on both my ajax and forms based upload. (although commons-fileupload-1.4.jar is still included) On 29/12/2022 09:38, Lukasz Lenart wrote: Take a look on that PR https://github.com/apache/struts/pull/650 Regards --

Re: Fileupload on JakartaEE

2022-12-29 Thread Lukasz Lenart
Take a look on that PR https://github.com/apache/struts/pull/650 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...

Re: Fileupload on JakartaEE

2022-12-29 Thread Lukasz Lenart
czw., 29 gru 2022 o 09:01 Yasser Zamani napisał(a): > Am I right that even if it was a servlet then it wasn't working too? as > per [1]. There is a slight problem with "keep using commons-fileupload" - it depends on "javax.servlet" package, while this package is available in the first version of

Re: Fileupload on JakartaEE

2022-12-29 Thread Yasser Zamani
Hi, Am I right that even if it was a servlet then it wasn't working too? as per [1]. Anyway in general I think we shouldn't try to keep supporting both. "Java EE is Officially Retired. It’s Now Called Jakarta EE. How Did We Get Here?" [2]. So I think at some day we may have a release that

Fileupload on JakartaEE

2022-12-28 Thread Lukasz Lenart
Hi, As I'm looking into supporting both worlds - JavaEE & JakartaEE - there are some problems with file upload support. commons-fileupload doesn't work with JakartaEE and migration to pure Servlet API based solution requires using @MultipartConfig annotation on the servlet - yet Struts uses a filt