2

Using JSF 2.1.1, EL API 2.2 and PrimeFaces 3.5 here. To version resources, I followed answer given here: How to use JSF versioning for resources in jar

My implementation of getRequestPath() is slightly different to use file modified time for as version:

@Override
public String getRequestPath() {
    String path = super.getRequestPath();
    long time = new File(resource.getURL().getFile()).lastModified();

    //  Resource from JARs
    if (time == 0) {
        return path;
    }

    if (path.contains("?")) {
        path += "&";
    } else {
        path += "?";
    }
    path += "t=" + time;
    return path;
}

With this, I have two problems.

  1. The & gets escaped. For example,

    <script type="text/javascript" src="/myapp/javax.faces.resource/myscript.js.xhtml?ln=js&amp;t=1390492662000">
    
  2. For EL expressions used in CSS like

    background: url("#{resource['mytheme:images/ui-bg_flat_75_F2F1F1_40x100.png']}");
    

I get error

Cannot evaluate EL expression resource['mytheme:images/ui-bg_flat_75_F2F1F1_40x100.png'] in resource mytheme.css

Please help!

Community
  • 1
  • 1
devmtl
  • 48
  • 1
  • 6

0 Answers0