Package ratpack.groovy
Support for writing Ratpack applications in the Groovy programming language.
Use of closures and
Key Features
The Groovy support provides the following key features:
- A
Closure
based Handler Chain building DSL - seeGroovyChain
. - Dynamic templates based on embedded groovy code - see
TextTemplateModule
. - Defining applications as a single script - see
Groovy.Ratpack
.
Use of closures and DelegatesTo
Ratpack makes heavy use of a feature of Groovy 2.1 that allows the delegate of a closure to be specified via the type system.
Namely, the DelegatesTo
annotation.
On all parts of the API where a Closure
is being accepted as a method parameter, the parameter will be
annotated with this annotation. This specifies the type of the closure delegate object during execution.
For more information on closure delegates, see this article.
When reading the API reference, it's important to take note of the DelegatesTo
annotation on closure parameters.
This parameter indicates what type to look at for information on what the closure can do.
-
Interface Summary Interface Description Groovy.Ratpack The definition of a Groovy Ratpack application. -
Class Summary Class Description Groovy Static methods for specialized Groovy integration.Groovy.Script Methods for working with Groovy scripts as application components.GroovyRatpackMain A boilerplate entry point, which combinesRatpackServer.start(Action)
andGroovy.Script.app()
.