MyFaces Core
  1. MyFaces Core
  2. MYFACES-2873

Provide a way to change the order of ELResolvers

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.9, 2.0.1
    • Fix Version/s: 1.2.11, 2.0.8, 2.1.2
    • Component/s: None
    • Labels:
      None

      Description

      When using CDI or Spring or any other framework/lib that provides a custom ELResolver there can be performance problems, because the custom ELResolvers from the faces-config are plugged in pretty early in the resolver chain.

      For CDI this means that for lots of trivial ELExpressions (like Array or Map value lookups) the CDI-ELResolver gets called and this resolver is not very performant, because it has to go through all Objects which are handled by CDI to find the fitting one. And in the most cases it won't find a fitting object, because the requested value is not handled by CDI.

      JSF currently only allows to sort the ELResolvers from different faces-config files, but not to change the order of predefined ELResolvers (like e.g. MapELResolver). Thus talking with Mark Struberg and Gerhard Petracek we came up with a Comparator<ELResolver> solution for this problem.

      The user can define a Comparator<ELResolver> via a web.xml config param and this comparator will be used to sort the ELResolvers before they are applied (but of course, only once). In addition we provide 3 default implementations: one to put every ELResolver from the faces-config to the front, one to put them to the back and one optimized for OpenWebBeans.

      This solution gives you many improvements:

      • you can tune your application by a customized order of ELResolvers
      • you don't need MyFaces implementation classes, but only a simple Comparator
      • if you switch to Mojarra or a earlier version of MyFaces, the ordering just won't work, but the behavior of the ELResolvers is the same

      The context-parameter will look like this (for the OWB-optimized resolver):

      <context-param>
      <param-name>org.apache.myfaces.EL_RESOLVER_COMPARATOR</param-name>
      <param-value>org.apache.myfaces.el.unified.OpenWebBeansELResolverComparator</param-value>
      </context-param>

      1. MYFACES-2873.patch
        27 kB
        Jakob Korherr

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Jakob Korherr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development