Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-11909

Custom resource mapping can't simply reuse pre-generated RichFaces resources

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.1.0.Final
    • Fix Version/s: 4.2.0.CR1
    • Component/s: core
    • Labels:
      None

      Description

      Custom resource mapping can't simply reuse pre-generated RichFaces resources.

      Use case:

      • user wants to use resource mapping for several purposes
        • using RichFaces pre-generated resources in richfaces-components-ui.jar/META-INF/resources/org.richfaces.staticResources/<version>/...
        • using custom mappings like javax.faces:jsf.js=patched-jsf.js using e.g. my.war/resources/patched-jsf.js

      With 4.1.0.Final, configuration of org.richfaces.resourceMapping.location is by default referring to root of packed resources:

      #{facesContext.externalContext.requestContextPath}/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/#{a4j.version.implementationVersion}/%Features%/#{resourceLocation} 
      

      and mapping file looks like:

      jquery.js=jquery.js
      

      When you want to reuse RichFaces mappings, you need to copy mapping file from richfaces-component-ui.jar and extend it by custom properties.

      and additionally you need to place custom resources to directory called specifically for RF, like:

      my.war/resources/org.richfaces.staticResource/4.1.0.Final/PackedCompressed/patched-jsf.js
      

      Other options:

      • change all mappings in custom-mappings.properties at own
      • copy all resources from richfaces-component-ui.jar to own location

      For simplification, I suggest default resource mapping location root be

      #{facesContext.externalContext.requestContextPath}/org.richfaces.resources/javax.faces.resource/#{resourceLocation}
      

      so it would refer to JSF resources root (my.war/resources or some.jar/META-INF/resources) by default.

      Then, we would force richfaces-components-ui.jar to define mappings which points from JSF resources root, e.g.:

      jquery.js=org.richfaces.staticResource/4.1.0.Final/PackedCompressed/jquery.js
      

      Additionally, Brian suggested support for multiple mapping.properties files, so their content will be merged.

      It means user won't be forced to copy&paste RichFaces mapping configuration from richfaces-components-ui.jar.


      Finally, the only thing user would need to define is:

      web.xml
      <context-param>
          <param-name>org.richfaces.resourceMapping.mappingFile</param-name>
          <param-value>META-INF/custom-mapping.properties</param-value>
      </context-param>
      
      META-INF/custom-mapping.properties
      javax.faces:jsf.js=patched-jsf.js
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lfryc Lukáš Fryč
                  Reporter:
                  lfryc Lukáš Fryč
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: