Reply To: Command not fired with multipart form (JSF 2.2)

Splash Forums PrettyFaces Users Command not fired with multipart form (JSF 2.2) Reply To: Command not fired with multipart form (JSF 2.2)

#26187

Hey Janario,

that’s awesome. Thanks for sharing you workaround.

I’ve also spent some time looking for the root cause of this issue in the last days. And I think you are correct. Undertow is using the incorrect form data parser and therefor the form data isn’t parsed correctly in case of multipart requests.

I think this is the relevant part of the Undertow source code:

https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/HttpServletRequestImpl.java#L720

The parseFormData() method is executed the first time HttpServletRequest.getParameter() or a similar method is called. Undertow first tries to identify the servlet that will handle the current request.

In case of a URL mapped by Rewrite, this typically won’t be the FacesServlet because a mapped URL doesn’t match the mapping of the FacesServlet and the first call to getParameter() will take place BEFORE the request is forwarded to the FacesServlet.

So the Undertow will typically use the DefaultServlet here. As the DefaultServlet isn’t a multipart-capable servlet as defined by the servlet spec, Undertow won’t use the correct form data parser.

So subclassing the DefaultServlet and making it multipart-capable is a valid workaround.

I’m not sure if this is really a bug in Undertow. The servlet spec isn’t very precise regarding this. 🙁

@lincoln: Any thoughts on this?