@ConstrainedTo(value=SERVER) public final class FreemarkerMvcFeature extends Object implements Feature
Feature used to add support for MVC and Freemarker templates.
Note: This feature also registers MvcFeature.| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_TEMPLATES
If
true then enable caching of Freemarker templates to avoid multiple compilation. |
static String |
ENCODING
Property defines output encoding produced by
TemplateProcessor. |
static String |
TEMPLATE_BASE_PATH
String property defining the base path to Freemarker templates. |
static String |
TEMPLATE_OBJECT_FACTORY
Property used to pass user-configured
FreemarkerConfigurationFactory. |
| Constructor and Description |
|---|
FreemarkerMvcFeature() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
configure(FeatureContext context)
A call-back method called when the feature is to be enabled in a given
runtime configuration scope.
|
public static final String TEMPLATE_BASE_PATH
String property defining the base path to Freemarker templates. If set, the value of the property is added in front
of the template name defined in:
Value can be absolute providing a full path to a system directory with templates or relative to current
servlet context.
There is no default value.
The name of the configuration property is "jersey.config.server.mvc.templateBasePath.freemarker".public static final String CACHE_TEMPLATES
true then enable caching of Freemarker templates to avoid multiple compilation.
The default value is false.
The name of the configuration property is "jersey.config.server.mvc.caching.freemarker".public static final String TEMPLATE_OBJECT_FACTORY
FreemarkerConfigurationFactory.
The default value is not set.
The name of the configuration property is "jersey.config.server.mvc.factory.freemarker".
This property will also accept an instance of Configuration directly, to
support backwards compatibility. If you want to set custom configuration then set
template loader to multi loader of:
WebappTemplateLoader (if applicable), ClassTemplateLoader and
FileTemplateLoader keep functionality of resolving templates.
If no value is set, a factory
with the above behaviour is used by default in the
FreemarkerViewProcessor class.
public static final String ENCODING
TemplateProcessor.
The value must be a valid encoding defined that can be passed
to the Charset.forName(String) method.
The default value is UTF-8.
The name of the configuration property is "jersey.config.server.mvc.encoding.freemarker".
public boolean configure(FeatureContext context)
Featuretrue if the feature was successfully enabled or false otherwise.
Note that under some circumstances the feature may decide not to enable itself, which
is indicated by returning false. In such case the configuration context does
not add the feature to the collection of enabled features and a subsequent call to
Configuration.isEnabled(Feature) or Configuration.isEnabled(Class) method
would return false.
Copyright © 2007-2016, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.