ICEfaces
  1. ICEfaces
  2. ICE-7417

MyFaces 2: ACE comp-suite example fails to find bridge.js and icepush.js resources if unique URLs are used

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta2
    • Fix Version/s: 3.0.RC2, 3.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2 MyFaces ACE
    • Assignee Priority:
      P2
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Compile ace with -Dmyfaces="true" and then add the following context parameter to the web.xml:


         <context-param>
              <param-name>org.icefaces.uniqueResourceURLs</param-name>
              <param-value>false</param-value>
          </context-param>
      Show
      Compile ace with -Dmyfaces="true" and then add the following context parameter to the web.xml:    <context-param>         <param-name>org.icefaces.uniqueResourceURLs</param-name>         <param-value>false</param-value>     </context-param>

      Description

      Comp Suite will not run on MyFaces for the following reasons:

      The work for http://jira.icefaces.org/browse/ICE-6118 is not complete. The ace directory still needs to be compiled against MyFaces due to the generated use of implementation specific MethodRule. This is done in ComponentHandlerArtifact.java:

              //The MethodRule class is specific to the JSF implementation in use so we check to see
              //which version, Mojarra or MyFaces is available, to determine which we should be importing.
              try {
                  Class.forName("com.sun.faces.facelets.tag.MethodRule");
                  generatedComponentHandlerClass.append("import com.sun.faces.facelets.tag.MethodRule;\n\n");
                  System.out.println("Mojarra version of MethodRule found");
              } catch (ClassNotFoundException e1) {
                  try {
                      Class.forName("org.apache.myfaces.view.facelets.tag.MethodRule");
                      generatedComponentHandlerClass.append("import org.apache.myfaces.view.facelets.tag.MethodRule;\n\n");
                      System.out.println("MyFaces version of MethodRule found");
                  } catch (ClassNotFoundException e2) {
                      System.out.println("cannot find a valid (Mojarra or MyFaces) MethodRule class " + e2);
                  }
              }
              
      Once you have compiled the ACE components against MyFaces, Comp Suite fails to load these resources:

      2-Nov-2011 4:34:40 PM org.apache.myfaces.renderkit.html.HtmlScriptRenderer encodeEnd
      WARNING: Resource referenced by resourceName icepush.js?rand=1900167016 not found in call to ResourceHandler.createResource. It will be silenty ignored.
      2-Nov-2011 4:34:40 PM org.apache.myfaces.renderkit.html.HtmlScriptRenderer encodeEnd
      WARNING: Resource referenced by resourceName bridge.js?rand=1900167016 not found in call to ResourceHandler.createResource. It will be silenty ignored.

      unless you specify:

         <context-param>
              <param-name>org.icefaces.uniqueResourceURLs</param-name>
              <param-value>false</param-value>
          </context-param>

      Looks like MyFaces doesn't like the ?rand= part of the resource. For some reason, this only seems to be a problem when running the ACE comp-suite. Running something like Auction with MyFaces, there are no warnings.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          Linking to case that refers to fixing the ACE generation code so that it doesn't rely on com.sun implementation classes.

          Show
          Deryk Sinotte added a comment - Linking to case that refers to fixing the ACE generation code so that it doesn't rely on com.sun implementation classes.
          Hide
          Deryk Sinotte added a comment -

          Linking to parent MyFaces 2 compatibility case.

          Show
          Deryk Sinotte added a comment - Linking to parent MyFaces 2 compatibility case.
          Hide
          Deryk Sinotte added a comment -

          My current theory is that is that the resource handlers are iterated in a non-deterministic order and the one of them is incorrectly handling the request and returning a null resource. That's why it occurs in ACE comp-suite but not in auction.

          Show
          Deryk Sinotte added a comment - My current theory is that is that the resource handlers are iterated in a non-deterministic order and the one of them is incorrectly handling the request and returning a null resource. That's why it occurs in ACE comp-suite but not in auction.
          Hide
          Deryk Sinotte added a comment -

          It appeared that the ResourceHandler.createResource methods (of which there are 3) are sensitive to which one is called. I was able to solve the problem by making the following change that minimizes what we override and only calls the single parameter version of createResource().

          Index: compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java
          ===================================================================
          — compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java (revision 26207)
          +++ compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java (revision )
          @@ -163,14 +163,6 @@
          }

          public Resource createResource(String resourceName)

          { - return createResource(resourceName, null, null); - }

          -

          • public Resource createResource(String resourceName, String libraryName) { - return createResource(resourceName, libraryName, null); - }

            -

          • public Resource createResource(String resourceName, String libraryName, String contentType)
            Unknown macro: { if (codeResource.localPath.equals(resourceName)) { //serving up the mapping as a referenced JS resource return codeResource; @@ -179,7 +171,7 @@ return cssResources.get(resourceName); } else { //let JSF serve the rest of resources - return super.createResource(resourceName, libraryName, contentType); + return handler.createResource(resourceName); } }
          Show
          Deryk Sinotte added a comment - It appeared that the ResourceHandler.createResource methods (of which there are 3) are sensitive to which one is called. I was able to solve the problem by making the following change that minimizes what we override and only calls the single parameter version of createResource(). Index: compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java =================================================================== — compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java (revision 26207) +++ compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextResourceHandler.java (revision ) @@ -163,14 +163,6 @@ } public Resource createResource(String resourceName) { - return createResource(resourceName, null, null); - } - public Resource createResource(String resourceName, String libraryName) { - return createResource(resourceName, libraryName, null); - } - public Resource createResource(String resourceName, String libraryName, String contentType) Unknown macro: { if (codeResource.localPath.equals(resourceName)) { //serving up the mapping as a referenced JS resource return codeResource; @@ -179,7 +171,7 @@ return cssResources.get(resourceName); } else { //let JSF serve the rest of resources - return super.createResource(resourceName, libraryName, contentType); + return handler.createResource(resourceName); } }
          Hide
          Deryk Sinotte added a comment -

          I've committed this patch to the icefaces2/trunk.

          Show
          Deryk Sinotte added a comment - I've committed this patch to the icefaces2/trunk.
          Hide
          Deryk Sinotte added a comment -

          Resolving as FIXED unless there is some dissent.

          Show
          Deryk Sinotte added a comment - Resolving as FIXED unless there is some dissent.
          Hide
          Deryk Sinotte added a comment - - edited

          This change had to be reverted as the fix, while working for MyFaces, caused Mojarra to fail. Re-opened and assigned to Mircea.

          Show
          Deryk Sinotte added a comment - - edited This change had to be reverted as the fix, while working for MyFaces, caused Mojarra to fail. Re-opened and assigned to Mircea.
          Hide
          Mircea Toma added a comment -

          The issue is caused by MyFaces' inability to lookup resources that have query strings appended to the path.

          The fix introduced MyFacesResourceHandlingFix resource handler to strip out the query string from the resource names when "uniqueResourceURLs" is set and Myfaces is used as the JSF implementation.

          Show
          Mircea Toma added a comment - The issue is caused by MyFaces' inability to lookup resources that have query strings appended to the path. The fix introduced MyFacesResourceHandlingFix resource handler to strip out the query string from the resource names when "uniqueResourceURLs" is set and Myfaces is used as the JSF implementation.
          Hide
          Mircea Toma added a comment - - edited

          Strip only the "rand" parameter from the query string. Do this in Myfaces and Mojarra.

          Show
          Mircea Toma added a comment - - edited Strip only the "rand" parameter from the query string. Do this in Myfaces and Mojarra.
          Hide
          Mircea Toma added a comment -

          Issue fixed by the refactoring done for ICE-7444.

          Show
          Mircea Toma added a comment - Issue fixed by the refactoring done for ICE-7444 .

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: