Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

Very simple usage

An instance of GroovyRestlet is the starting point of everything.

You can programmatically create an instance of GroovyRestlet:

Constructor method of #2 indicates that this instance of GroovyRestlet will consult Spring's ApplicationContext when constructing its component. So the Spring integration is done.

Alternatively, you can choose to declare GroovyRestlet in Spring bean definition. By this way, GroovyRestlet will automatically use its parent context when constructing its compoents.

Spring Integration

When Spring's ApplicationContext is provided, GroovyRestlet will try to consult Spring context for creating its components.
Two special attributes are provided for integrating GroovyRestlet and Spring.

  • ofBean: to tell GroovyRestlet that to create a component from Spring context by a bean name;
  • ofClass: to tell GroovyRestlet that to create a component using Spring's AutowireCapableBeanFactory
Icon

GroovyRestlet will only use AutowireCapableBeanFactory to create instance indicated by ofClass when Spring context is provided. Otherwise it will create an instance of that class using Java reflection

Technical detail

RestletBuilder

RestletBuilder is a simple implementation of Groovy's FactoryBuilderSupport. By default, all constructor factories are registered. Users are able choose which constructors are to be used freely.

To do this programmatically, just set a list of constructor factories after a build instance is created.

Alternatively, you can do this in Spring bean definition

Global variables

Constructors

restlet

server

client

component

application

router

filter

redirector

guard

directory

resource

  • No labels