Adding Groovy Support

Calyxo Control may be easily configured to add support for the Groovy scripting language (requires Groovy JSR-03 or later).

You only have to specify a different class loader to your module context. Just use groovy.lang.GroovyClassLoader as the module's class loader and tell it to load groovy classes from /WEB-INF/groovy by adding the following to your configuration:

<use value="${moduleContext}">
  <property name="classLoader">
    <object class="groovy.lang.GroovyClassLoader">
      <constructor>
        <arg value="${moduleContext.classLoader}"/>
      </constructor>
      <method name="addClasspath">
        <arg>
          <member value="${moduleContext.servletContext}">
            <method name="getRealPath">
              <arg value="/WEB-INF/groovy"/>
            </method>
          </member>
        </arg>
      </method>
    </object>
  </property>
</use>

Now the module will search for user defined classes in /WEB-INF/groovy before falling back to the default class loading mechanism.

This means that you now can either use Groovy or Java to implement any of your classes that will be loaded by this module!

Groovy Accessors, EL Functions, Plugins, Actions, Filters, ...