eXo Platform 3.5

## Chapter 21. REST Services on Groovy

## Concept

Starting from version 1.9, JCR Service supports REST services creation on Groovy script.

The feature bases on RESTful framework and uses ResourceContainer concept.

## Usage

Scripts should extend ResourceContainer and should be stored in JCR as a node of type exo:groovyResourceContainer.

Detailed REST services step-by-step implementation check there Create REST service step by step.

Component configuration enables Groovy services loader:

    <component>

      <type>org.exoplatform.services.jcr.ext.script.groovy.GroovyScript2RestLoader</type>

      <init-params>

        <object-param>

          <name>observation.config</name>

          <object type="org.exoplatform.services.jcr.ext.script.groovy.GroovyScript2RestLoader$ObservationListenerConfiguration">

            <field name="repository">

              <string>repository</string>

            </field>

            <field name="workspaces">

              <collection type="java.util.ArrayList">

                <value>

                  <string>collaboration</string>

                </value>

              </collection>

            </field>

          </object>

        </object-param>

      </init-params>

    </component>