spring-framework / org.springframework.web.reactive.result.view.freemarker / FreeMarkerView

FreeMarkerView

open class FreeMarkerView : AbstractUrlBasedView

A View implementation that uses the FreeMarker template engine.

Depends on a single FreeMarkerConfig object such as FreeMarkerConfigurer being accessible in the application context. Alternatively set the FreeMarker configuration can be set directly on this class via #setConfiguration.

The url property is the location of the FreeMarker template relative to the FreeMarkerConfigurer's templateLoaderPath.

Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher.

Author
Rossen Stoyanchev

Since
5.0

Constructors

<init>

FreeMarkerView()

A View implementation that uses the FreeMarker template engine.

Depends on a single FreeMarkerConfig object such as FreeMarkerConfigurer being accessible in the application context. Alternatively set the FreeMarker configuration can be set directly on this class via #setConfiguration.

The url property is the location of the FreeMarker template relative to the FreeMarkerConfigurer's templateLoaderPath.

Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

checkResourceExists

open fun checkResourceExists(locale: Locale): Boolean

Check that the FreeMarker template used for this view exists and is valid.

Can be overridden to customize the behavior, for example in case of multiple templates to be rendered into a single view.

setConfiguration

open fun setConfiguration(configuration: Configuration): Unit

Set the FreeMarker Configuration to be used by this view.

Typically this property is not set directly. Instead a single FreeMarkerConfig is expected in the Spring application context which is used to obtain the FreeMarker configuration.

setEncoding

open fun setEncoding(encoding: String): Unit

Set the encoding of the FreeMarker template file.

By default FreeMarkerConfigurer sets the default encoding in the FreeMarker configuration to "UTF-8". It's recommended to specify the encoding in the FreeMarker Configuration rather than per template if all your templates share a common encoding.

Inherited Functions

getUrl

open fun getUrl(): String

Return the URL of the resource that this view wraps.

setUrl

open fun setUrl(url: String): Unit

Set the URL of the resource that this view wraps. The URL must be appropriate for the concrete View implementation.

toString

open fun toString(): String