EL configuration functions

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
m (Configuration EL Library moved to EL configuration functions)
 
Line 1: Line 1:
 +
{{Cleanup}}
 +
 
Resin 3.0.14 has added the capability of adding functions to the resin.conf EL expressions.
 
Resin 3.0.14 has added the capability of adding functions to the resin.conf EL expressions.
  

Latest revision as of 13:17, 1 December 2011

40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit http://www.caucho.com/documentation/ for the most up-to-date documentation.

Resin 3.0.14 has added the capability of adding functions to the resin.conf EL expressions.

The builtin functions are:

  1. class_exists - test if the class is loadable
  2. jndi_lookup - perform a jndi lookup of the name
  3. 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:

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)}"

Personal tools