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)

#26184

Janario Oliveira
Participant

Hi, I tried in 2.0.12.Final and also in 2.0.13.Final-SNAPSHOT. Same happens.

It works with this workaround:

1 – Add undertow-servlet as provided dependency:

        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-servlet</artifactId>
            <version>1.0.0.Final</version><!--same version o wildfly-->
            <scope>provided</scope>
        </dependency>

2 – extends DefaultServlet from undertow and add @MultipartConfig


@WebServlet(name = io.undertow.servlet.handlers.ServletPathMatches.DEFAULT_SERVLET_NAME, urlPatterns = "/*")
@MultipartConfig
public class MultipartDefaultServlet extends io.undertow.servlet.handlers.DefaultServlet { }

After that the parameters will appears in the filter and also be able to invoke jsf actions.

The problem is that WildFly associate a parser according to the servlet mapped


HttpServletRequestImpl.parseFormData
  io.undertow.server.handlers.form.FormEncodedDataDefinition always added
  io.undertow.server.handlers.form.MultiPartParserDefinition only added in multipart servlets, DefaultServlet doesn't handle multipart.

If I map FacesServlet to same pattern of URLMapping FacesServlet will handle multipart.

Trying to reproduce(without the workaround) I create a simple html(multipart.html) and try to see the parameters in a WebFilter


<form enctype="multipart/form-data" method="post">
    <input name="testeParam" value="testeValue"/>
    <input type="submit"/>
</form>

@WebFilter(urlPatterns = "/*")
public class TestFilter implements Filter {
  doFilter
     request.getParameterMap()
}

The parameters are always empty. In JBoss same happens but when it is a request of a rewrite mapped(URLMapping) the parameters came in the filter.

So, What do you think? Is it a bug in WildFly? but in basic sample(multipart.html) parameters are empty even in JBoss