MyFaces Commons
  1. MyFaces Commons
  2. MFCOMMONS-45

CLONE - MyFaces ResourceImpl$ValueExpressionFilterInputStream does not handle resolving long URLs

    Details

      Description

      We have logged an issue in our own JIRA tracker for this issue as well: http://jira.icefaces.org/browse/ICE-7518

      It was discovered running on Liferay but the issue turn out to be not specific to portlets - it's simply manifest more obviously there. Given a CSS file with an EL resource such as:

      url("#

      {resource['icefaces.ace:themes/sam/images/ui-default.png']}

      ")

      MyFaces will typically return something like:

      url("/my/javax.faces.resource/themes/sam/images/ui-default.png.jsf?ln=icefaces.ace")

      When running on Liferay, the returned URL will be much longer given the portlet namespacing and the various Liferay request parameters:

      url("http://localhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")

      However, the URL that is actually written into our CSS file looks like this:

      url("lhost:8080/web/guest/acefile?_fileEntry_WAR_showcaseportlet_ln=icefaces.ace&_fileEntry_WAR_showcaseportlet_javax.faces.resource=themes%2Fsam%2Fimages%2Fui-default.png&p_p_col_count=1&p_p_col_id=column-1&p_p_id=fileEntry_WAR_showcaseportlet&p_p_lifecycle=2")

      The URL is missing characters at the front

      lhost:8080/web

      instead of

      http://localhost:8080/web

      Almost all the resource URLs in our CSS file are mangled in a similar way. After a lot of head scratching, it turns out that the URLs are longer than ResourceImpl$ValueExpressionFilterInputStream is prepared to handle:

      private class ValueExpressionFilterInputStream extends InputStream
      {
      private PushbackInputStream delegate;

      public ValueExpressionFilterInputStream(InputStream in)

      { super(); delegate = new PushbackInputStream(in,255); }

      ...

      For us, setting the "unread" buffer to a higher number than 255 appears to solve the issue. Perhaps this could be done a different way to account for longer URLs or at least made configurable if someone needs to adjust it.

        Issue Links

          Activity

          Deryk Sinotte created issue -
          Leonardo Uribe made changes -
          Field Original Value New Value
          Link This issue is a clone of MYFACES-3414 [ MYFACES-3414 ]
          Leonardo Uribe made changes -
          Project MyFaces Core [ 10600 ] MyFaces Commons [ 12310846 ]
          Key MYFACES-3417 MFCOMMONS-45
          Affects Version/s 1.0.2 [ 12318450 ]
          Affects Version/s 2.1.3 [ 12317642 ]
          Affects Version/s 2.1.4 [ 12317868 ]
          Component/s myfaces-commons-resourcehandler [ 12314322 ]
          Component/s General [ 12310160 ]
          Leonardo Uribe made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Leonardo Uribe [ lu4242 ]
          Fix Version/s 1.0.2.1 [ 12319243 ]
          Resolution Fixed [ 1 ]
          Leonardo Uribe made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development