javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2401

Regression: Resolving resources via EL expressions requires a library

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.0-m02
    • Fix Version/s: 2.2.0-m07
    • Component/s: resources
    • Labels:
      None
    • Environment:

      Mojarra 2.2

      Description

      It's unclear to me at this point whether this is intended or a regression. I ended up creating a relatively simple test case that shows a couple of behavioural differences between Mojarra 2.1.x and 2.2 related to getting/creating resources. The problem can be seen in a couple of ways:

      1) In a CSS file, I used the following expression which properly resolves in Mojarra 2.1.x but does not resolve in Mojarra 2.2:

      background: url("#

      {resource['css/images/background.png']}

      ");

      If I make a slight change to the resource path so that it uses a library:resource strategy, it does work:

      background: url("#

      {resource['css:images/background.png']}

      ");

      2) Similar to the above, if I programmatically try to create a resource using one method of the ResourceHandler API it works in Mojarra 2.1 but not in 2.2:

      FacesContext fc = FacesContext.getCurrentInstance();
      ResourceHandler handler = fc.getApplication().getResourceHandler();

      //Creating a resource this way works in Mojarra 2.1 but not in 2.2
      Resource resource = handler.createResource("css/images/background.png");

      //Creating a resource by splitting it up and using the library name works in Mojarra 2.2
      //Resource resource = handler.createResource("images/background.png", "css", "image/png");

      String resourceAsString = null;
      try

      { resourceAsString = resource.toString(); }

      catch (Exception e)

      { resourceAsString = "** could not create resource " + COMBINED_NAME + " **"; }

      return resourceAsString;

      In Development mode, you also will see the following logged in both instances where it doesn't work:

      30-Apr-2012 3:22:02 PM com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource
      WARNING: JSF1064: Unable to find or serve resource, css/images/background.png.

      That attached test file should show both the behaviours I've described here.

        Issue Links

          Activity

          Hide
          Ed Burns added a comment -

          Are the contents of the email sensitive are could they be added to the case for discussion?

          All emails to the JSR-344 EG are publically readable. Please see the users list at < http://jsf-spec.java.net/lists/ >.

          Show
          Ed Burns added a comment - Are the contents of the email sensitive are could they be added to the case for discussion? All emails to the JSR-344 EG are publically readable. Please see the users list at < http://jsf-spec.java.net/lists/ >.
          Hide
          Ed Burns added a comment -

          I just verified the test works on the 2.1.x branch. I'm pretty sure the problem is just on the trunk and is due to my implementation of JAVASERVERFACES_SPEC_PUBLIC-809.

          Show
          Ed Burns added a comment - I just verified the test works on the 2.1.x branch. I'm pretty sure the problem is just on the trunk and is due to my implementation of JAVASERVERFACES_SPEC_PUBLIC-809 .
          Show
          Ed Burns added a comment - Mark as resolved when < http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_TRUNK_DEPLOY/42/ > and < http://tim-vm9.us.oracle.com:7070/hudson/view/Mojarra%20Trunk/job/trunk-test-glassfish-3_1_2_2/103/ > are clear.
          Hide
          Ed Burns added a comment -

          Wrong order. First resolve, then close.

          Show
          Ed Burns added a comment - Wrong order. First resolve, then close.
          Hide
          Ed Burns added a comment -

          Both jobs passed, change successfully inserted.

          Show
          Ed Burns added a comment - Both jobs passed, change successfully inserted.

            People

            • Assignee:
              Ed Burns
              Reporter:
              dmsinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 35 minutes
                2h 35m