1 2 Previous Next 25 Replies Latest reply on Feb 23, 2010 3:11 AM by stefan_tausendpfund Go to original post
      • 15. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
        wesleyhales

        Thanks again for troubleshooting this. So are you saying if I set the allowFlash attribute to true, that it will work in both Firefox and IE?

        also I just deployed a snapshot here:

        http://snapshots.jboss.org/maven2/org/jboss/portletbridge/portletbridge-impl/

        • 16. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
          wesleyhales

          Also, does the issue have anything to do with this?

          https://jira.jboss.org/jira/browse/RF-7190

          • 17. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
            stefan_tausendpfund

            Hello Wesley,

             

            the upload always works using firefox and opera.

             

            On IE8 fileupload does not work with javascript enabled (tested with IE7/ IE8 compatibility and IE8). I have deployed a sample application on hxxp://80.190.140.117:8080/portal/portal/default/RichFacesEchoPortlet

            where you also can see the XML response in a4j:log.In the response the javax.faces.ViewState is included but the javascript method findViewState does not find this input element in XML response and so the transfer error is printed out in IE8. Here the according lines in fileUpload.js:

             

             onlload: function() {
                            if (this.isError()) {
                                    this.callback(FileUploadEntry.UPLOAD_TRANSFER_ERROR);
                                    return;
                            }
                            var iframeDocument = this.iframe.contentWindow.document;
                            var elt = iframeDocument.getElementById('_richfaces_file_upload_stopped');
                            var restr = iframeDocument.getElementById('_richfaces_file_upload_size_restricted');
                            var forb = iframeDocument.getElementById('_richfaces_file_upload_forbidden');
                            var state = this.findViewState(iframeDocument); // <- this method does not find the ViewState in response
                            
                            if (elt) {
                                    this.callback(FileUploadEntry.UPLOAD_CANCELED);
                            } else if (restr) {
                                    this.callback(FileUploadEntry.UPLOAD_SIZE_ERROR);
                            } else if (forb) {
                                    this.callback(FileUploadEntry.UPLOAD_SIZE_ERROR);
                            } else if (state) { // <- state is null so the upload_success message is not shown
                                    this.viewStateUpdater(state.value);
                                    this.callback(FileUploadEntry.UPLOAD_SUCCESS);
                            } else {
                                    this.callback(FileUploadEntry.UPLOAD_TRANSFER_ERROR);
                            }
                    },
                    
                    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);
                    },
            

             

             

            Here the according XML response from aj4:log:

            debug[10:47:17,031]: Full response content: 
            <?xml version="1.0"?><html 
            xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body><div 
            id="jbpns_2fdefault_2fRichFacesEchoPortlet_2fRichFacesEchoPortletWindowsnpbj"><meta 
            name="Ajax-Update-Ids" content="" /><span 
            id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" 
            id="javax.faces.ViewState" 
            value="H4sIAAAAAAAAAL1baWwcVx1/u3biI4EkdZWjSdqNE+Km2ex92HHT1nbixnSdGNtJaULrzO4+744zOzPMvPWOE6W0lUolKpUiaAUiFRUg8aX9AkgcHwqoiEoVBVEJgSqBKoQESBwSqlTgA/COufeNvT52R8l4rnf8///f/3xvX/sb2KZr4D5Fq8SEJcHILOmLMUFVJbEkIFGRY/MahHNIq5dQXYMXlDJ85vP/+PKbi0d7dwJgqDcA6AYgT1ovFRVdj6mKhiSIippYrsBYSampigxlFLs0NcPejOFBLouwMasoCPQtLFuX7AiDY56ZOB1UUU2KkcaTilYD25YWxHLSbnRiSVgWjNiiUIK6v815fLpYR2odzUMDsZYpYB33rtFyRpCh9DCmhjVM20OeJPPUxFI1sOmkKMFLqqQIZbC9zv6Shr2qplQ0qOsgumYXM+an44IGttOJD9szP+EVGb6IzV2ambk4O6/IbDjSIeY4ZHMN4ikZh/B1rq4S4TE6M8B9rMVek0lKXQXdoryomM26wfG1KSRN2ZhZ3CQEtlehUIbaukWac813/YDIe9m66pTPCkhwEGEJJLQ+YkfsZq0jkCIgmbCJHFpNrNOwLAqMTLNh0h7yCH9IrKOCJtQwYky0JVvTE2wEuu7gTdXSlu71yIM1dQC47qbZjTfNbbypg6ChNXEwp+I3Fo8djU62oqYTSq0myOXxOkKKbBqFxO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gtVTaKFoHwUdNiEl00gF4zYNsMF5Hohmf17E66xxi8/bmw80jFlk7b9tWfCp1oBaXs3YDtw7eS2bhJkKXRiNTdl0uCLybyD5LSTJkm5dKktZSSdKTzh/ypvNsD6q7JBlKN8eaPPqTW7DCkCvnOsCJlJV4phJuTgRskmVrDJ7Nsa4sg5dRZMGRpoCzJEFBY/ekYsLJ+WxTBYiReQRMBRqZ7HA0l4gIJfJDDE5s6x+K1nEGJsjTiI1q8sadNrguW7r2Hm4uvEKXOHabMg+bNW17Kb9praOFpbD2Yk4odgJzViKbciWy+BS6wd+EiUDCvVDC1sn9q/FjFALWErjPuVloPM7ZO4KxSyFc4C/SH24emg1lL9HPg9lAeOaS0XzahOcqy/NNcxg0jNb1yWrNHumb0if3hFeZqDUU1aePzJpPt1iTmrC/GfXYy3kWpB7hIPUoUndxgpxOEsqvtEtRUlaCnAreeEm2uTpOu4s5bbp7ooTM2tsQna7RxFhv5tiuxbTcMC2gCu1jEvuTtn8x0XJIs+OSDiN0y9rpyOqu/MCWbrfMjeQDaqY95g8xaBjqL5mSE0RgfwADspvaBehE8xNgLNgwDHsqn8EbADsgcKtKkPLsi7jTrRzWr2CaFITy19KN0BtG84a4oINXJ/SXXzm/rGnTBpRsfqQjypW1f+3jVa6vOmrT730TuLUk9MbaW0ucqMm1MSQoXGp1a8i+jXM5AzvCZStNTbnSVKzvHmwVlIor2EagK5VI0L9jhYIvJ7HL/PjtcIJG9g+o/we30GgVyDwAAA==" 
            autocomplete="off" /></span><meta id="Ajax-Response" 
            name="Ajax-Response" content="true" /><span 
            id="_ajax:data"><![CDATA[ 34162 
            ]]></span></div></body></html>
            

             

             

             

            If useFlash is enabled fileupload also works with IE8 on localhost and on this sample host. But we also have a solaris machine where the upload button is disabled. This behavior is also mentioned in the JIRA task RF-7190. So this need some further investigation.

             

             

            regards

              Stefan

            • 18. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
              stefan_tausendpfund

              Hello,

               

              useflash=true and ssl enabled seems not to work with IE8. In firefox you need to add the ssl exception and the upload works fine. In IE8 you can accept the certificate but the add button only renders in disabled mode.

               

              regards

                Stefan

              • 19. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                stefan_tausendpfund

                Hello Wesley,

                 

                in ui.pack.js I added a LOG debug to F.body.innerHTML. I deployed the same app as portlet and as web app and tested it with IE8.

                Using the web app uploading with IE works fine and the content of F.body.innerHTML is a clean XML:

                debug[16:43:27,921]: CONTENT of Body: <META name=Ajax-Update-Ids content=""><SPAN 
                id=ajax-view-state><INPUT id=javax.faces.ViewState value=j_id1 type=hidden 
                name=javax.faces.ViewState autocomplete="off"></SPAN><META 
                id=Ajax-Response name=Ajax-Response content=true><META 
                name=Ajax-Update-Ids content=""><SPAN id=ajax-view-state><INPUT 
                id=javax.faces.ViewState value=j_id1 type=hidden name=javax.faces.ViewState 
                autocomplete="off"></SPAN><META id=Ajax-Response name=Ajax-Response 
                content=true>
                

                 

                The same app in portlet environment shows up that the content in F.body.innerHTML is encoded in IE8:

                debug[16:33:54,281]: CONTENT of Body: 
                <DIV class=e><SPAN class=b> </SPAN> <SPAN 
                class=m>&lt;?</SPAN><SPAN class=pi>xml version="1.0" 
                </SPAN><SPAN class=m>?&gt;</SPAN> </DIV><DIV 
                class=e><DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em" class=c><A 
                class=b onfocus=h() onclick="return false" href="#">-</A> <SPAN 
                class=m>&lt;</SPAN><SPAN class=t>html</SPAN><SPAN 
                class=ns> xmlns</SPAN><SPAN class=m>="</SPAN><B 
                class=ns>http://www.w3.org/1999/xhtml</B><SPAN 
                class=m>"</SPAN><SPAN class=m>&gt;</SPAN></DIV>
                <DIV><DIV class=e><DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 
                1em" class=c><A class=b onfocus=h() onclick="return false" 
                href="#">-</A> <SPAN class=m>&lt;</SPAN><SPAN 
                class=t>head</SPAN><SPAN 
                class=m>&gt;</SPAN></DIV><DIV><DIV class=e>
                <DIV style="TEXT-INDENT: -2em; MARGIN-LEFT: 1em"><SPAN 
                class=b> </SPAN> <SPAN 
                class=m>&lt;</SPAN><SPAN class=t>title</SPAN> <SPAN 
                class=m>/&gt;</SPAN> </DIV></DIV><DIV><SPAN 
                class=b> </SPAN> <SPAN
                ....
                

                 

                So the JS fails to find the javax.faces.ViewState entry and print out the transfer error.

                 

                Do you have any idea why the reponse is encoded in the iframe on IE8 within the portlet?

                 

                regards

                   Stefan

                • 20. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                  wesleyhales
                  We are working on setting up an IE8 test environment, Alex or myself will look into this for next release. It is strange to see the encoding difference between the 2 browsers. Thanks again for looking into this.
                  • 21. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                    prabhat.jha
                    We are currently expanding coverage of bridge testing and will include these kinds of testing as well.
                    • 22. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                      stefan_tausendpfund

                      Hello Wesley,

                       

                      finally I had some time to continue the research for the strange behaviour in IE. The IE seems to have a problem when response is of type "text/xml" and therefore encodes the xml in html. So the upload component can not find the ViewState entry and creates a "Transfer Error". A normal RF web app returns a "text/html" content-type for the multipart request.

                      A small patch in setupRenderParams in RichfacesStrategy fixes this issue:

                      --- core/portletbridge-impl/src/main/java/org/jboss/portletbridge/richfaces/RichFacesStrategy.java      (revision 569)
                      +++ core/portletbridge-impl/src/main/java/org/jboss/portletbridge/richfaces/RichFacesStrategy.java      (working copy)
                      @@ -196,10 +196,13 @@
                                      if(ajaxContext.isAjaxRequest(facesContext)){
                                              // Set XML response.
                                              Object response = facesContext.getExternalContext().getResponse();
                      -                       if (response instanceof MimeResponse) {
                      -                   MimeResponse mimeResponse = (MimeResponse) response;
                      -                   mimeResponse.setContentType(XML_CONTENT);
                      -            }
                      +                       Object request = facesContext.getExternalContext().getRequest();
                      +                       if(!(request instanceof ResourceRequest && isMultipartContent((ResourceRequest) request))){
                      +                               if (response instanceof MimeResponse) {
                      +                                       MimeResponse mimeResponse = (MimeResponse) response;
                      +                                       mimeResponse.setContentType(XML_CONTENT);
                      +                               }
                      +                       }
                                      }
                              }
                      

                       

                       

                      regards

                        Stefan

                      • 23. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                        wesleyhales

                        Just finished testing this latest patch and it's available here:

                        https://snapshots.jboss.org/maven2/org/jboss/portletbridge/portletbridge-api/2.0.0-SNAPSHOT/portletbridge-api-2.0.0-20100222.213155-1.jar

                        https://snapshots.jboss.org/maven2/org/jboss/portletbridge/portletbridge-impl/2.0.0-SNAPSHOT/portletbridge-impl-2.0.0-20100222.213155-1.jar

                         

                        Thanks again Stefan for helping out with this. Please test on your end and let us know if you run into any more problems.

                        • 24. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                          wesleyhales
                          remove the "https" for the url and use http
                          • 25. Re: Can't get rich:fileUpload to work (using 2.0.0.A)
                            stefan_tausendpfund

                            Hello Wesley,

                             

                            Thanks a lot - it works like a charm!

                            1 2 Previous Next