Announcement Announcement Module
Collapse
No announcement yet.
Problem of using richfaces fileUpload component with SWF Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem of using richfaces fileUpload component with SWF

    Hello, I newbie in SWF.
    I have a problem of using richfaces fileUpload component with SWF.
    If I use component without SWF, then all works fine.
    When I load file in SWF application, I get file transfer error. I tried to experiment with rich:fileUpload, and I find, that error arises, when component already uploaded file and tried to store it in internal depository. If I determine fileUploadListener I can get file, and can store it to my DB, before error arises in component.
    So, I can subscribe error message as "all right" and take no notice for error in component, and save files to DB, but when error really arise I will not know about it.

    Did anybody try to use rich:fileUpload with SWF? Does it can me anybody to advise anything on this issue?

    Beforehand thank you.
    I am sorry for my bad English.

  • #2
    Hi!

    I've exactly the same problem, that the file gets uploaded normally, the listener is called and I can access org.richfaces.event.UploadEvent to get the File I just uploaded but then as described by Dmak an error message "Transfer error occuried" appears next to the file entry in the list.
    Beside the error message shouldn't appear when everything is correct I could live with that -

    BUT
    If I have more files in the list before hitting the Upload Button then just the first file of the list gets uploaded and fires the UploadEvent. The 2nd file doesn't gets touched. Then if I click upload again - the 2nd file gets uploaded and so on

    Please help.

    Thanks!

    Comment


    • #3
      Hi, I am a newbie in SWF too.
      And I have the same problem...
      about "transfert error occured" on richfaces upload component...

      The first who found the answer, post here please ;-)

      Comment


      • #4
        Map the extensionFilter to the correct DispatchServlet

        I had a similar problem with SWF and Tomahawk inputFileUpload. May be that might give you some idea on richFaces.

        <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
        </filter>

        <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>

        Try changing it to

        <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Spring MVC Dispatch Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>


        The problem was that...

        "When Spring Web Flow comes into picture, the faces Servlet is not the big guy delivering the views - its Spring's MVC Dispatcher Servlet that serves the requests"

        Although, everyone advises Tomahawk Extensions Filter to be mapped to Faces Servlet. That doesnt serve well when we have SWF in between. So, instead of the following fliter-mapping in web.xml.

        <filter-mapping>
        <filter-name>Extensions Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        </filter-mapping>

        Try this :
        <filter-mapping>
        <filter-name>Extensions Filter</filter-name>
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
        </filter-mapping>

        <!-- Map all /spring requests to the Dispatcher Servlet for handling -->
        <servlet-mapping>
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
        <url-pattern>/spring/*</url-pattern>
        </servlet-mapping>

        <filter>
        <filter-name>Extensions Filter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsF ilter</filter-class>
        <init-param>
        <description>
        Set the size limit for uploaded files.
        Format: 10 - 10 bytes
        10k - 10 KB
        10m - 10 MB
        1g - 1 GB
        </description>
        <param-name>uploadMaxFileSize</param-name>
        <param-value>100m</param-value>
        </init-param>
        <init-param>
        <description>
        Set the threshold size - files below this limit are stored
        in memory, files above this limit are stored on disk.
        Format: 10 - 10 bytes
        10k - 10 KB
        10m - 10 MB
        1g - 1 GB
        </description>
        <param-name>uploadThresholdSize</param-name>
        <param-value>100k</param-value>
        </init-param>
        <init-param>
        <description>
        Set the path where the intermediary files will be stored.
        </description>
        <param-name>uploadRepositoryPath</param-name>
        <param-value>/temp</param-value>
        </init-param>
        </filter>

        Comment


        • #5
          Hi,
          when I use richfaces fileupload component I also get the error message "Transfer error occuried"
          The reason for this message seems to be that in FileUpload.js the following code

          findViewState: function(d) {

          var s = 'javax.faces.ViewState';

          var input = d.getElementsByTagName("input");

          for (var i in input) {

          if (input[i].name == s) {

          return input[i];

          }

          }

          return d.getElementById(s);

          },


          is looking for an input element with name "javax.faces.ViewState". However, within SWF, this element doesn't get rendered. When I use the fileupload component outside SWF the following input element appears in html-code:

          <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id6" />

          and the above error message doesn't appear.

          Does anybody have an idea why the hidden input element doesn't get rendered within SWF?

          Comment


          • #6
            rich:upload with &quot;useFlash=true&quot;

            I experienced the same transfer error message, but setting the rich:upload attribute "useFlash" (as mentioned in thread 59485) to true made it work like a charm (haven't tried with IE6 though).

            SWF version: 2.0.5
            RichFaces version: 3.3.0

            Comment


            • #7
              ok, I have tried the 3.3.0 - without flash there is no difference, but when I set the attribute allowFlash="true" (don't know why this is called useFlash in your case) uploading works -
              but :-) the button called "Add..." has no text in Firefox when using Ubuntu (under Windows FF&IE Add... is there ;-)
              But it works!! Thanks alot!

              Comment


              • #8
                The message "Transfer error occuried" is due to the missing "'javax.faces.ViewState" input field. The rendering of this element is prevented by FlowViewStateManager in SWF 2.0.5.
                Meanwhile this problem has been fixed in 2.0.6 nightly build and fileupload works now fine even without allowFlash="true".

                Comment


                • #9
                  i am new to this forum , would anyone please tell me how do i post new threads.

                  thanks

                  Comment


                  • #10
                    Hi,
                    I just can't get rich:fileupload working - can someone please tell me what is missing:

                    Clicking the upload button gives a Nullpointer in
                    org.richfaces.renderkit.FileUploadRendererBase.doD ecode

                    Problem seems to be in this lines of code:

                    Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) externalContext.getSessionMap().get(FileUploadCons tants.REQUESTS_SESSIONS_BEAN_NAME);
                    MultipartRequest multipartRequest = map.get(uid);

                    my web.xml:
                    <filter>
                    <display-name>Ajax4jsf Filter</display-name>
                    <filter-name>ajax4jsf</filter-name>
                    <filter-class>org.ajax4jsf.Filter</filter-class>
                    <init-param>
                    <param-name>createTempFiles</param-name>
                    <param-value>false</param-value>
                    </init-param>
                    <init-param>
                    <param-name>maxRequestSize</param-name>
                    <param-value>1000000</param-value>
                    </init-param>
                    </filter>

                    <filter-mapping>
                    <filter-name>ajax4jsf</filter-name>
                    <servlet-name>Spring Web MVC Dispatcher Servlet</servlet-name>
                    <dispatcher>REQUEST</dispatcher>
                    <dispatcher>FORWARD</dispatcher>
                    <dispatcher>INCLUDE</dispatcher>
                    </filter-mapping>

                    xhtml:
                    <rich:fileUpload fileUploadListener="#{UploadBB.listener}"
                    maxFilesQuantity="30"
                    id="upload"
                    immediateUpload="true"
                    acceptedTypes="jpg, gif, png, bmp"
                    allowFlash="true">
                    <a4j:support event="onuploadcomplete" reRender="info" />
                    </rich:fileUpload>


                    So... what is wrong?
                    I need help please

                    thanks,

                    Jan

                    Comment

                    Working...
                    X