myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Resolved] (MYFACES-2873) Provide a way to change the order of ELResolvers
Date Fri, 17 Jun 2011 14:56:47 GMT

     [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Leonardo Uribe resolved MYFACES-2873.
-------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.0.2)
                   2.1.2
                   2.0.8
                   1.2.11

I reviewed the stack trace and the problem is an EL expressions is created from a location
where no ExternalContext is setup (TrinidadFilter). 

The comparator or predicate used to sort/filter EL resolvers should be created by FacesConfigurator
and attached to RuntimeConfig object, so it just can be used from Application implementation
instance later without retrieve ExternalContext instance. I thought it was something related
to the algorithm but at the end it was a side effect. Thanks for the report.

> Provide a way to change the order of ELResolvers
> ------------------------------------------------
>
>                 Key: MYFACES-2873
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2873
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 1.2.9, 2.0.1
>            Reporter: Jakob Korherr
>            Assignee: Leonardo Uribe
>             Fix For: 1.2.11, 2.0.8, 2.1.2
>
>         Attachments: MYFACES-2873.patch
>
>
> 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>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message