File upload component under prettyfaces mapped url doesn't upload anything

Splash Forums PrettyFaces Users File upload component under prettyfaces mapped url doesn't upload anything

This topic contains 6 replies, has 3 voices, and was last updated by  giates 1 year, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26359

    giates
    Participant

    Hi,

    inserting fileupload component (PrimeFaces5) that perfectly uploads files in a non mapped url (ex. /index.xhtml) it doesn’t upload anything if used in a prettyfaces mapped url (ex. /test), no javascript errors, no server side errors, simply not upload anything…

    I’ve write a test that shows the problem in a JEE7 maven very simple application, you can clone the project using:

    git clone https://bitbucket.org/giates2000/testprettyfacesprimefaces5uploadproblem

    Can anyone help me to understand where is the problem ?

    This happens on Glassfish 4 with latest mojarra library, primefaces 5 and rewrite-servlet/rewrite-integration-faces/rewrite-config-prettyfaces 2.0.12.Final

    Notice that I must use PrettyFaces (can’t use rewrite module only because I must load some specific data using url parameters before page rendering…)

    Many thanks in advance…

    #26360

    Hey. Could you check if the workaround from here helps:

    http://ocpsoft.org/rewrite/docs/faq

    See the “Why are file uploads not working correctly any more?” section.

    #26368

    giates
    Participant

    I’ve tried but no luck, same problem…

    I’ve updated my test application at: https://bitbucket.org/giates2000/testprettyfacesprimefaces5uploadproblem

    Now I’ve refactored the test application dropping prettyfaces annotations and inserting rewrite configuration provider, but the problem is still there, as soon as I’m using a rewrited url fileUpload doesn’t upload anything, when the same component is used without url rewriting it correctly upload the files…

    • This reply was modified 1 year, 11 months ago by  giates.
    #26377

    ageldt
    Participant

    guys, your forum is broken.

    ones cannot create topics anymore because form validation doesn’t let you. It’s always saying that the Topic must be not empty, when it is actually not empty.

    #26390

    giates
    Participant

    Any news about the issue ?

    Seems that the problem appears only when I’m using rewrite module…

    Notice that I’ve just tested the test application (see posts above) on Glassfish v. 4.1 and the problem is still there…

    #26391

    @ageldt:

    I think < and > don’t work well in forum topics any may cause this error. Could you check that?

    @giates:

    I don’t know about any workarounds for this issue which work on Glassfish. Sorry.

    As described in the FAQ, there is really no way for Rewrite to work around this issue. Rewrite has to use methods like HttpServletRequest.getParameter() which breaks multipart requests in some containers.

    AFAIK the Tomcat workaround doesn’t work in Glassfish (although Glassfish uses Tomcat internally, right?). Wildfly in the newest version should work. Older versions have to be patched.

    One thing that COULD work in Glassfish is to create a rule that basically prevents that other Rewrite rules are evaluated for the URL that contains the upload component. So you could try to add this in front of all your other rules:

    .addRule()
    .when( Direction.isInbound().and( Path.matches( "/somepath/my-upload.jsf" ) ) )
    .perform( Lifecycle.handled() )
    

    But this means that you have a Join or anything else for this URL.

    It’s just a guess. Perhaps it helps. 🙂

    #26398

    giates
    Participant

    Hi Christian,

    many thanks for your response.

    I’ve found a solution, if I insert commons file upload dependency to my project and set:

    <context-param>
        <param-name>primefaces.UPLOADER</param-name>
        <param-value>commons</param-value>
      </context-param>
      <filter>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name> 
        <dispatcher>REQUEST</dispatcher>              
        <dispatcher>FORWARD</dispatcher>              
      </filter-mapping>

    into web.xml I can correctly upload the files using Rewrite module on Glassfish 4.1

    Probably using commons fileupload the request.getParameter of Rewrite module is working good…

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

You must be logged in to reply to this topic.

Comments are closed.