[
https://issues.apache.org/jira/browse/WICKET-7154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950778#comment-17950778
]
ASF GitHub Bot commented on WICKET-7154:
----------------------------------------
reiern70 commented on PR #1160:
URL: https://github.com/apache/wicket/pull/1160#issuecomment-2869892035
> IMO this change could be done in `master`, i.e. 10.x. There is no real
need to create `wicket-11.x` branch yet. If you agree then please delete it!
Yes. This is correct. Initially I thought the problem was the we are using
fileupload2 for servelt5 specification and that servelet 6 version was needed.

But this was not correct. Using 6 does not solves the problem. After that I
tried to use tomcat own upload machinery,
https://github.com/reiern70/file-upload-broken/blob/master/src/main/java/com/mycompany/TomcatMultipartServletWebRequestImpl.java
This didn't work either... Thus, I realized the problem was some change on
behavior in tomcat 11. Another side effect is wicket filter becomes not so nice
as you can't use @UploadConfig on filters (and neither use API/code to specify
upload properties on a filter).
Regarding using tomcat file upload machinery
https://github.com/reiern70/file-upload-broken/blob/master/src/main/java/com/mycompany/TomcatMultipartServletWebRequestImpl.java#L138
it allows to set a "progress" listener. Thus, you can till support upload
progress.
> wicket multipart support is broken for tomcat 11.0.6
> ----------------------------------------------------
>
> Key: WICKET-7154
> URL: https://issues.apache.org/jira/browse/WICKET-7154
> Project: Wicket
> Issue Type: Improvement
> Affects Versions: 10.4.0
> Reporter: Ernesto Reinaldo Barreiro
> Priority: Blocker
> Fix For: 11.0.0
>
>
> It seems wicket file upload functionality that depends on
> *commons-fileupload2* is broken for tomcat 11.x (I have tested with 11.0.5
> and 11.0.6).
> First I though this is because tomcat 10.x is using
> commons-fileupload2-jakarta-servlet5 thus I upgraded to
> commons-fileupload2-jakarta-servlet6 but the problem is the same.
>
> It seems that tomcat 11.0.6 is already handling multipart and "consuming" the
> request thus when we file-upload2 tries to parse the request the underlying
> IdentityInputFilter
>
> ([https://github.com/apache/tomcat/blob/11.0.x/java/org/apache/coyote/http11/filters/IdentityInputFilter.java)|https://github.com/apache/tomcat/blob/11.0.x/java/org/apache/coyote/http11/filters/IdentityInputFilter.java_]
>
> has already "consumed" the request. This also affects upload progress
> functionality.
> {*}Note{*}: I have tried to solve this is wicket but I think it can't be
> solved in a general way...
> {*}Why{*}: whenever to call getPostParameters in wicket tomcat will parse the
> multipart by itself and the request will be consumed. Thus, if anything
> before Form is processed calls
> webRequest.getPostParameters().getParameterValue("XXX") then
> MultipartServletWebRequest will not work (as tomcat will consume the
> request). I have
> [reported|https://lists.apache.org/thread/99r9wtlqrbm0gc309w985yl1khfp41nt]
> this on Tomcat users list and they requested a "quick-start". I created one
> using wicket.
>
> {*}Additional info{*}: Tomcat 11 does not support multipart "out of the box".
> You need to either set
>
> <Context allowCasualMultipartParsing="true">
> ...
> </Context>
>
> or us @MultipartConfig on a wicket servlet.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)