ICEfaces
  1. ICEfaces
  2. ICE-8996

OutputStyleRender checking for .css extension causes problems when URL includes parameters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Compat Components

      Description

      A couple of recent forum postings:

      http://www.icesoft.org/JForum/posts/list/21716.page#76295
      http://www.icesoft.org/JForum/posts/list/21306.page#74870

      have noted that they are seeing this being logged:

      2012-09-24 14:17:19,339 ERROR com.icesoft.faces.component.style.OutputStyleRenderer - Error in OutputStyleRenderer java.lang.RuntimeException: OutputStyle file attribute must end in .css. Current Value is [/app/javax.faces.resource/tce.css.iface?ln=css] at com.icesoft.faces.component.style.OutputStyleRenderer.encodeEnd(OutputStyleRenderer.java:119) - See more at: http://www.icesoft.org/JForum/posts/list/21306.page#74870

      It seems that if you use the #{resource['css:styles.css']} style syntax, the library name is automatically added to the URL. The OutputStyleRenderer is doing a fairly brute force check to see if the URL (rather than the file) ends with .css and bails if it encounters something like /app/javax.faces.resource/styles.css.iface?ln=css.

      So we should make the checking a bit smarter in order to allow the use of the #{resource} EL syntax.
      1. liferay.2013-03-15.log
        27 kB
        yip.ng
      1. screenshot-01.png
        186 kB
      2. screenshot-02.png
        123 kB
      3. screenshot-03.png
        149 kB

        Activity

        Hide
        yip.ng added a comment - - edited

        It's not enough to just not throw an exception: (as suggested by some forum users, naïvely thinking it is just harmless, unnecessary exception)

        • The renderer is trying to insert a secondary style sheet with a different file name suffix depending on the browser. JSF 2 resource path structure is not as straight forward as old style paths. (E.g. /ace-showcase/javax.faces.resource/themes/my_theme/override_header.css.jsf?ln=css&v=3_3_0_130306.) Requires complex pattern matching and extraction.
        • The renderer also checks for the existence of the secondary style sheet using getRealPath(). getRealPath() simple doesn't work with JSF 2 resource paths. Again there is no simple straight forward way. Need to pattern-match and extract the library name and resource path first.
        Show
        yip.ng added a comment - - edited It's not enough to just not throw an exception: (as suggested by some forum users, naïvely thinking it is just harmless, unnecessary exception) The renderer is trying to insert a secondary style sheet with a different file name suffix depending on the browser. JSF 2 resource path structure is not as straight forward as old style paths. (E.g. /ace-showcase/javax.faces.resource/themes/my_theme/override_header.css.jsf?ln=css&v=3_3_0_130306.) Requires complex pattern matching and extraction. The renderer also checks for the existence of the secondary style sheet using getRealPath(). getRealPath() simple doesn't work with JSF 2 resource paths. Again there is no simple straight forward way. Need to pattern-match and extract the library name and resource path first.
        Hide
        yip.ng added a comment - - edited

        Done. (screenshot-03.png) Rendering logic closely matches the existing handling of old-style paths, but with cleaner code. (screenshot-01.png) Tried testing portlets as required by Ken, but even after following Deryk's wiki instructions several times, still can't get any portlets to run. (screenshot-02.png)

        M: C:\svn\ossrepo\icefaces3\trunk\icefaces\compat\components\src\main\java\com\icesoft\faces\component\style\OutputStyleRenderer.java#33838

        Show
        yip.ng added a comment - - edited Done. ( screenshot-03.png ) Rendering logic closely matches the existing handling of old-style paths, but with cleaner code. ( screenshot-01.png ) Tried testing portlets as required by Ken, but even after following Deryk's wiki instructions several times, still can't get any portlets to run. ( screenshot-02.png ) M: C:\svn\ossrepo\icefaces3\trunk\icefaces\compat\components\src\main\java\com\icesoft\faces\component\style\OutputStyleRenderer.java#33838
        Hide
        yip.ng added a comment - - edited

        Tried testing portlets yet again starting from scratch, i.e. starting from liferay bundle download. Still doesn't work, (screenshot-02.png) but this time I found a log file in liferay which logged some NullPointerExceptions and a ConcurrentModificationException: liferay.2013-03-15.log.

        Show
        yip.ng added a comment - - edited Tried testing portlets yet again starting from scratch, i.e. starting from liferay bundle download. Still doesn't work, ( screenshot-02.png ) but this time I found a log file in liferay which logged some NullPointerExceptions and a ConcurrentModificationException: liferay.2013-03-15.log .
        Hide
        Deryk Sinotte added a comment -
        • This is something that Yip has worked on but has been unable to test on portlets. I was able to see that the renderer now properly handles the resource EL approach in portlets. It successfully rendered out the following in my test:
        <link href="http://localhost:8080/web/guest/outputstyle?p_p_id=panel_WAR_showcaseportlet&amp;p_p_lifecycle=2&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_cacheability=cacheLevelPage&amp;p_p_col_id=column-1&amp;p_p_col_count=1&amp;_panel_WAR_showcaseportlet_javax.faces.resource=override_header.css&amp;_panel_WAR_showcaseportlet_ln=css" rel="stylesheet" type="text/css">

        Not sure of the issues that Yip was having running the portlets but I can follow that up separately.

        Show
        Deryk Sinotte added a comment - This is something that Yip has worked on but has been unable to test on portlets. I was able to see that the renderer now properly handles the resource EL approach in portlets. It successfully rendered out the following in my test: <link href= "http: //localhost:8080/web/guest/outputstyle?p_p_id=panel_WAR_showcaseportlet&amp;p_p_lifecycle=2&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_cacheability=cacheLevelPage&amp;p_p_col_id=column-1&amp;p_p_col_count=1&amp;_panel_WAR_showcaseportlet_javax.faces.resource=override_header.css&amp;_panel_WAR_showcaseportlet_ln=css" rel= "stylesheet" type= "text/css" > Not sure of the issues that Yip was having running the portlets but I can follow that up separately.
        Hide
        yip.ng added a comment - - edited

        [3:02:15 PM] Deryk Sinotte: ant -Dliferayfaces="true" clean liferay6.servlet-profile

        [2013-03-18 4:27:20 PM] Yip: Working now. Thanks a lot!

        Show
        yip.ng added a comment - - edited [3:02:15 PM] Deryk Sinotte: ant -Dliferayfaces="true" clean liferay6.servlet-profile [2013-03-18 4:27:20 PM] Yip: Working now. Thanks a lot!

          People

          • Assignee:
            yip.ng
            Reporter:
            Deryk Sinotte
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: