ICEfaces
  1. ICEfaces
  2. ICE-6846

ACE YUI loader script issue when wrapping request

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, EE-2.0.0.GA
    • Fix Version/s: 2.0.2, EE-2.0.0.GA_P01
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      -
    • Affects:
      Compatibility/Configuration

      Description

      The customer has reported the following. They have upgraded their application from 2.0.0 to 2.0.1 and upon startup are seeing requests for javascript resources with a URI that does not include the context path and results in a 404. The incorrect resources are:

      * http://localhost:8080/Sample/javax.faces.resource/yui/3_1_1/oop/oop-min.js.xhtml
      * http://localhost:8080/Sample/javax.faces.resource/yui/3_1_1/pluginhost/pluginhost-min.js.xhtml
      * http://localhost:8080/Sample/javax.faces.resource/yui/2in3/yui2-tabview/yui2-tabview-min.js.xhtml

      The "Sample" portion of the URI is added by a Response wrapper which is not the context path and is removed by a filter so that the normal url-mappings are applied. Other resources are correctly prefixed with the context path:

      * http://localhost:8080/CONTEXTPATH/Sample/javax.faces.resource/oop/oop-min.js.xhtml?ln=yui/3_1_1

      He sees that oop-min.js is added twice: once with the incorrect path and once with the correct one.

      The customer is using the ACE tabset and dateTimeEntry components and as a result these errors, both are not working. The following is also shown in the Firebug console:

      Y.Plugin is undefined (line 115 of animation.js)
      Y.on is not a function (line 33 of tabset.js)

      The problem does not occur when he removes the code that adds the prefix in the response wrapper:

      <script id="yui_3_1_1_1_13045343789972" type="text/javascript" charset="utf-8" src="/CONTEXTPATH/javax.faces.resource/yui/3_1_1/oop/oop-min.js.xhtml"></script>

      and here is with the wrapper:

      <script id="yui_3_1_1_1_13045343789972" type="text/javascript" charset="utf-8" src="/Sample/javax.faces.resource/yui/3_1_1/oop/oop-min.js.xhtml"></script>

      It appears as though only scripts with an id="yui..." have this problem. The customer has also observed that for the non working scripts, the encodeURL method of his wrapper (adds "Sample" prefix) is never called so he thinks the path of these resources is created by javascript, perhaps by only keeping the first part on the left and wrongly assuming that the path before "javax.faces.resource" only has 1 part instead of 2 (/Part1/Part2).

      He was able to reproduce this by wrapping the request and overriding the getContextPath method for it to return a context path with more than one part ("/PART1/PART2") instead of wrapping the response. Here is an example:

      new HttpServletRequestWrapper(request) {
      @Override
      public String getContextPath() {
      return super.getContextPath() + "/Sample";
      }};

      Sample application attached http://localhost:8080/test-jsf2/TEST/test.jsf

        People

        • Assignee:
          Arturo Zambrano
          Reporter:
          Tyler Johnson
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: