JSF2 form with multipart/form-data enctype is not processed properly

Splash Forums Rewrite Users JSF2 form with multipart/form-data enctype is not processed properly

This topic contains 5 replies, has 2 voices, and was last updated by  Christian Kaltepoth 5 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18597

    pavel.arnost
    Participant

    Hi,

    I have problem with JSF2 form with “multipart/form-data” enctype. When request is handled through ‘addRule(Join.path(“/uprava-profilu”).to(“/myProfileEdit.html”)’, bean action method is not called. When I remove this rule and go through myProfileEdit.html directly, form works.

    Do you have any idea what can be wrong?

    I use MyFaces 2.1.8.

    Thanks,

    Regards

    Pavel

    #22810

    Hmmm… That’s weird. Could you perhaps a minimal example application to reproduce this. This would be very helpful.

    #22811

    pavel.arnost
    Participant

    Hi Christian,

    I uploaded simple test project. It has dependency on PrimeFaces for org.primefaces.webapp.filter.FileUploadFilter. PrimeFace’s filter is quite simple and uses commons fileupload for parsing multipart content.

    In attached project, /works.html works, but /index does not.

    Thanks,

    Regards

    Pavel

    #22812

    Thanks. I’ll have a look at it as soon as possible.

    BTW: Did you try to change the ordering of RewriteFilter and FileUploadFilter?

    #22813

    pavel.arnost
    Participant

    Hi,

    I changed:

    <filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    to:

    <filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ASYNC</dispatcher>
    <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    and it works now, thanks.

    Regards

    Pavel

    #22814

    Glad to hear you got it working.

    Yes, other filters may need to add <dispatcher>FORWARD</dispatcher> to their definition because Rewrite “forwards” the request internally and you need this setting to also apply the filter for these forwarded requests.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Comments are closed.