spring-framework / org.springframework.web.servlet.view.groovy

Package org.springframework.web.servlet.view.groovy

Types

GroovyMarkupConfig

interface GroovyMarkupConfig

Interface to be implemented by objects that configure and manage a Groovy MarkupTemplateEngine for automatic lookup in a web environment. Detected and used by GroovyMarkupView.

GroovyMarkupConfigurer

open class GroovyMarkupConfigurer : TemplateConfiguration, GroovyMarkupConfig, ApplicationContextAware, InitializingBean

An extension of Groovy's groovy.text.markup.TemplateConfiguration and an implementation of Spring MVC's GroovyMarkupConfig for creating a MarkupTemplateEngine for use in a web application. The most basic way to configure this class is to set the "resourceLoaderPath". For example:

 // Add the following to an @Configuration class @Bean public GroovyMarkupConfig groovyMarkupConfigurer() { GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer(); configurer.setResourceLoaderPath("classpath:/WEB-INF/groovymarkup/"); return configurer; } 
By default this bean will create a MarkupTemplateEngine with:
  • a parent ClassLoader for loading Groovy templates with their references
  • the default configuration in the base class TemplateConfiguration
  • a groovy.text.markup.TemplateResolver for resolving template files
You can provide the MarkupTemplateEngine instance directly to this bean in which case all other properties will not be effectively ignored.

This bean must be included in the application context of any application using the Spring MVC GroovyMarkupView for rendering. It exists purely for the purpose of configuring Groovy's Markup templates. It is not meant to be referenced by application components directly. It implements GroovyMarkupConfig to be found by GroovyMarkupView without depending on a bean name. Each DispatcherServlet can define its own GroovyMarkupConfigurer if desired.

Note that resource caching is enabled by default in MarkupTemplateEngine. Use the #setCacheTemplates(boolean) to configure that as necessary.

Spring's Groovy Markup template support requires Groovy 2.3.1 or higher.

GroovyMarkupView

open class GroovyMarkupView : AbstractTemplateView

An AbstractTemplateView subclass based on Groovy XML/XHTML markup templates.

Spring's Groovy Markup Template support requires Groovy 2.3.1 and higher.

GroovyMarkupViewResolver

open class GroovyMarkupViewResolver : AbstractTemplateViewResolver

Convenience subclass of @link AbstractTemplateViewResolver} that supports GroovyMarkupView (i.e. Groovy XML/XHTML markup templates) and custom subclasses of it.

The view class for all views created by this resolver can be specified via the #setViewClass(Class) property.

Note: When chaining ViewResolvers this resolver will check for the existence of the specified template resources and only return a non-null View object if a template is actually found.