EL configuration functions

From Resin 3.0

Revision as of 04:20, 14 February 2006 by Sam (Talk | contribs)
Jump to: navigation, search

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