I am trying to write a custom Expression Language (EL) resolver. The purpose of this resolver is to intercept method calls to a certain Bean to add a second parameter. I have written a custom EL resolver that overwrites the invoke
-method to do what I want. I also put the resolver in the faces-config.xml
as required.
Unfortunately, I have a dependency in my project that also declares custom EL Resolvers and they are placed before my EL resolver in the resolver chain. Since one of the other resolvers already handles the invoke
-method, my custom invoke
-method never gets called.
Is there any way to reorder the resolvers so that my resolver gets called first? I am aware that Apache MyFaces offers a mechanism for ordering the resolvers, but unfortunately I can't get MyFaces to work in my project.
Put the EL resolver in a separate web fragment project which ultimately ends up as JAR in webapp's /WEB-INF/lib
. In the web fragment project's faces-config.xml
, declare the ordering to be "before others" as below.
<ordering>
<before>
<others />
</before>
</ordering>
Or if the "other dependency" has also a faces-config.xml
file with a <name>
declared, then explicitly declare that name in the ordering. This would be the only way if the "other dependency" happens to also have exactly the above ordering set.
<ordering>
<before>
<name>nameOfThatOtherDependency</name>
</before>
</ordering>
Noted should be that this affects the entire faces-config.xml
.