Uploaded image for project: 'MyFaces Commons'
  1. MyFaces Commons
  2. MFCOMMONS-45

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

    XMLWordPrintableJSON

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.

      Attachments

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              dmsinotte Deryk Sinotte
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: