EL configuration functions
From CauchoWiki
(Redirected from Configuration EL Library)
Resin 3.0.14 has added the capability of adding functions to the resin.conf EL expressions.
The builtin functions are:
- class_exists - test if the class is loadable
- jndi_lookup - perform a jndi lookup of the name
- jndi - shorthand for jndi_lookup
The standard configuration library is com.caucho.config.lib.ResinConfigLibrary.
Libraries are configured using the standard META-INF/services convention.
First, create a Java class with static methods you'd like to create as a library.
Then create a META-INF/services/com.caucho.config.ConfigLibrary file:
[edit] com.caucho.config.ConfigLibrary file
com.foo.MyLibrary
For example, you could create an add method:
package com.foo;
public class MyLibrary {
public static int add(int a, int b)
{
return a + b;
}
}
Then, in your resin.conf you could use EL expressions like "${add(3, 17)}"
