Kauri Documentation
 PreviousHomeNext 
6.5 Some backgroundBook Index6.6 Default routing

6.5.2 Groovy as routing configuration syntax

The configuration syntax for the routing is not a plain data file like XML, but rather an executable program in the form of a Groovy script. Groovy has a standard pattern for describing tree-structures in an easy-to-read manner, which will look like a plain data syntax unless you start making use of more advanced features. This way of using an existing programming language in such a way that it looks like a specialized syntax is called an internal DSL.

Groovy as syntax: pro and con

Some of the pro's of using Groovy as syntax are:

To be fair, some cons are:

Groovy performance

You might have heard that Groovy is slow and hence naively think that doing the routing in Groovy will introduce a bottleneck in the system. This is a false reasoning, since the Groovy script is executed only once and serves to create the internal routing structure. It is really just an alternative for other e.g. XML syntax. The internal routing structure doesn't make use of Groovy and could be built up by other means as well.

 PreviousHomeNext 
6.5 Some background6.6 Default routing