File upload widget?

Michal Petrov richfaces-dev at lists.jboss.org
Fri Mar 7 11:29:06 EST 2014


Well, it's not a Mojarra issue. The issue is with Undertow (http://undertow.io/) (the web server used by WildFly).

When the request is sent on server (HttpServletRequestImpl) we're wrapping it in MultiPartRequest30, after that the request parameters cannot be reached. But for some reason it is working if I access the parameters before the request is wrapped.

from FileUploadFacesContextFactory:
{code:modifiedtitle=true|jivemacro_uid=_13942091424358239|class=jive_text_macro jive_macro_code _jivemacro_uid_13942091424358239}
if (httpRequest.getContentType() != null && httpRequest.getContentType().startsWith("multipart/")) {

    String uid = getParameterValueFromQueryString(httpRequest.getQueryString(), UID_KEY);



    Enumeration<String> e = httpRequest.getParameterNames();

    // without this line the parameters are inaccessible 



    if (uid != null) {

        long contentLength = Long.parseLong(httpRequest.getHeader("Content-Length"));



        …


                    

        HttpServletRequest wrappedRequest;

        if (ServletVersion.getCurrent().isCompliantWith(ServletVersion.SERVLET_3_0)) {

            wrappedRequest = wrapMultipartRequestServlet30((ServletContext) context, httpRequest, uid,

                             contentLength, progressControl);

        } else {

            wrappedRequest = wrapMultipartRequestServlet25((ServletContext) context, httpRequest,

                             uid, contentLength, progressControl);

        }



    /*



    wrappedRequest.getParameter("javax.faces.ViewState") 

    returns null unless the getParameterNames() method was called



    */

    }

}

{code}

I'm not yet sure about the root of the issue but there seems to be a check for files being sent in the request which is why it only seems to affect fileUpload (that and I don't think we're wrapping the requests anywhere else).

Posted by forums
Original post: https://community.jboss.org/message/861277#861277



More information about the richfaces-dev mailing list