You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/08/11 15:05:16 UTC

[jira] Created: (MYFACES-2873) Provide a way to change the order of ELResolvers

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: 2.0.1
            Reporter: Jakob Korherr
            Assignee: Jakob Korherr


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr reopened MYFACES-2873:
------------------------------------


You are right, Bernd. We can do this for 1.2.x too!

> 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: Jakob Korherr
>             Fix For: 2.0.2-SNAPSHOT
>
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr resolved MYFACES-2873.
------------------------------------

    Fix Version/s: 1.2.10-SNAPSHOT
       Resolution: Fixed

Now it works in 2.0.2 and 1.2.10.

> 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: Jakob Korherr
>             Fix For: 1.2.10-SNAPSHOT, 2.0.2-SNAPSHOT
>
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2873:
-----------------------------------

           Status: Resolved  (was: Patch Available)
    Fix Version/s: 2.0.2-SNAPSHOT
       Resolution: Fixed

> 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: 2.0.1
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>             Fix For: 2.0.2-SNAPSHOT
>
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr updated MYFACES-2873:
-----------------------------------

    Status: Patch Available  (was: Open)

> 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: 2.0.1
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898952#action_12898952 ] 

Jakob Korherr commented on MYFACES-2873:
----------------------------------------

Documentation about this new feature in the cwiki: https://cwiki.apache.org/confluence/display/MYFACES/ELResolver+ordering

> 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: 2.0.1
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>             Fix For: 2.0.2-SNAPSHOT
>
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2873) Provide a way to change the order of ELResolvers

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898960#action_12898960 ] 

Bernd Bohmann commented on MYFACES-2873:
----------------------------------------

Should this feature myfaces 2.0 only? What about 1.2?

> 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: 2.0.1
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>             Fix For: 2.0.2-SNAPSHOT
>
>         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.
-
You can reply to this email to add a comment to the issue online.