You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/03/13 10:58:10 UTC
[34/50] incubator-freemarker-site git commit: 2.3.26-nightly docs
preview
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/pgui_config_sharedvariables.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/pgui_config_sharedvariables.html b/builds/2.3.26-nightly/pgui_config_sharedvariables.html
new file mode 100644
index 0000000..d90f624
--- /dev/null
+++ b/builds/2.3.26-nightly/pgui_config_sharedvariables.html
@@ -0,0 +1,143 @@
+<!doctype html>
+<!-- Generated by FreeMarker/Docgen from DocBook -->
+<html lang="en" class="page-type-section">
+<head prefix="og: http://ogp.me/ns#">
+<meta charset="utf-8">
+<title>Shared variables - Apache FreeMarker Manual</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<meta name="format-detection" content="telephone=no">
+<meta property="og:site_name" content="Apache FreeMarker Manual">
+<meta property="og:title" content="Shared variables">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/pgui_config_sharedvariables.html">
+<link rel="canonical" href="http://freemarker.org/docs/pgui_config_sharedvariables.html">
+<link rel="icon" href="favicon.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono">
+<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979">
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-55420501-1', 'auto');
+ga('send', 'pageview');
+</script>
+</head>
+<body itemscope itemtype="https://schema.org/Code">
+ <meta itemprop="url" content="http://freemarker.org/docs/">
+ <meta itemprop="name" content="Apache FreeMarker Manual">
+
+ <!--[if lte IE 9]>
+ <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div>
+ <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker">
+</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc
h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui.html"><span itemprop="name">Programmer's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config.html"><span itemprop="name">The Configuration</span></a></li><li class="step-3" itempr
op="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config_sharedvariables.html"><span itemprop="name">Shared variables</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width">
+ <div class="content-wrapper">
+ <div id="table-of-contents-wrapper" class="col-left">
+ <script>var breadcrumb = ["Apache FreeMarker Manual","Programmer\'s Guide","The Configuration","Shared variables"];</script>
+ <script src="toc.js?1489402528979"></script>
+ <script src="docgen-resources/main.min.js?1489402528979"></script>
+ </div>
+<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="pgui_config_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_settings.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="pgui_config_sharedvariables" itemprop="headline">Shared variables</h1>
+</div></div><p><strong>Shared variables</strong> are variables
+ that are defined for all templates. You can add shared variables to
+ the configuration with the <code class="inline-code">setSharedVariable</code>
+ methods:</p>
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">Configuration cfg = new Configuration(Configuration.VERSION_2_3_25);
+<em>..</em>.
+cfg.setSharedVariable("warp", new WarpDirective());
+cfg.setSharedVariable("company", "Foo Inc.");</pre></div><p>In all templates that use this configuration, an user-defined
+ directive with name <code class="inline-code">wrap</code> and a string with name
+ <code class="inline-code">company</code> will be visible in the data-model root, so
+ you don't have to add them to the root hash again and again. A
+ variable in the root object that you pass to the
+ <code class="inline-code">Template.process</code> will hide the shared variable with
+ the same name.</p> <div class="callout warning">
+ <strong class="callout-label">Warning!</strong>
+
+ <p>Never use <code class="inline-code">TemplateModel</code> implementation that
+ is not <a href="gloss.html#gloss.threadSafe">thread-safe</a> for
+ shared variables, if the configuration is used by multiple threads!
+ This is the typical situation for Servlet based applications.</p>
+ </div>
+<p>Due to backward compatibility heritage, the set of shared
+ variables is initially (i.e., for a new
+ <code class="inline-code">Configuration</code> instance) not empty. It contains the
+ following user-defined directives (they are "user-defined" in the
+ sense that you use <code class="inline-code">@</code> to call them instead of
+ <code class="inline-code">#</code>):</p> <div class="table-responsive">
+ <table class="table">
+
+ <thead>
+ <tr>
+ <th>name</th>
+
+
+ <th>class</th>
+
+ </tr>
+
+ </thead>
+
+
+ <tbody>
+ <tr>
+ <td><code class="inline-code">capture_output</code></td>
+
+
+ <td><code class="inline-code">freemarker.template.utility.CaptureOutput</code></td>
+
+ </tr>
+
+
+ <tr>
+ <td><code class="inline-code">compress</code></td>
+
+
+ <td><code class="inline-code">freemarker.template.utility.StandardCompress</code></td>
+
+ </tr>
+
+
+ <tr>
+ <td><code class="inline-code">html_escape</code></td>
+
+
+ <td><code class="inline-code">freemarker.template.utility.HtmlEscape</code></td>
+
+ </tr>
+
+
+ <tr>
+ <td><code class="inline-code">normalize_newlines</code></td>
+
+
+ <td><code class="inline-code">freemarker.template.utility.NormalizeNewlines</code></td>
+
+ </tr>
+
+
+ <tr>
+ <td><code class="inline-code">xml_escape</code></td>
+
+
+ <td><code class="inline-code">freemarker.template.utility.XmlEscape</code></td>
+
+ </tr>
+
+ </tbody>
+
+ </table>
+ </div>
+<div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="pgui_config_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_settings.html"><span>Next</span></a></div></div></div></div> </div>
+ </div>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href
="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p>
+<p class="copyright">
+� <span itemprop="copyrightYear">1999</span>\u20132017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
+</div></div></div></body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/pgui_config_templateconfigurations.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/pgui_config_templateconfigurations.html b/builds/2.3.26-nightly/pgui_config_templateconfigurations.html
new file mode 100644
index 0000000..2c2f86c
--- /dev/null
+++ b/builds/2.3.26-nightly/pgui_config_templateconfigurations.html
@@ -0,0 +1,314 @@
+<!doctype html>
+<!-- Generated by FreeMarker/Docgen from DocBook -->
+<html lang="en" class="page-type-section">
+<head prefix="og: http://ogp.me/ns#">
+<meta charset="utf-8">
+<title>Template configurations - Apache FreeMarker Manual</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<meta name="format-detection" content="telephone=no">
+<meta property="og:site_name" content="Apache FreeMarker Manual">
+<meta property="og:title" content="Template configurations">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/pgui_config_templateconfigurations.html">
+<link rel="canonical" href="http://freemarker.org/docs/pgui_config_templateconfigurations.html">
+<link rel="icon" href="favicon.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono">
+<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979">
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-55420501-1', 'auto');
+ga('send', 'pageview');
+</script>
+</head>
+<body itemscope itemtype="https://schema.org/Code">
+ <meta itemprop="url" content="http://freemarker.org/docs/">
+ <meta itemprop="name" content="Apache FreeMarker Manual">
+
+ <!--[if lte IE 9]>
+ <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div>
+ <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker">
+</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc
h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui.html"><span itemprop="name">Programmer's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config.html"><span itemprop="name">The Configuration</span></a></li><li class="step-3" itempr
op="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config_templateconfigurations.html"><span itemprop="name">Template configurations</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width">
+ <div class="content-wrapper">
+ <div id="table-of-contents-wrapper" class="col-left">
+ <script>var breadcrumb = ["Apache FreeMarker Manual","Programmer\'s Guide","The Configuration","Template configurations"];</script>
+ <script src="toc.js?1489402528979"></script>
+ <script src="docgen-resources/main.min.js?1489402528979"></script>
+ </div>
+<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="pgui_config_errorhandling.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_outputformatsautoesc.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="pgui_config_templateconfigurations" itemprop="headline">Template configurations</h1>
+</div></div><p>"Template configurations" refers to the
+ <code class="inline-code">template_configurations</code> setting of
+ <code class="inline-code">Configuration</code>
+ (<code class="inline-code">Configuration.setTemplateConfigurations(<em class="code-color">...</em>)</code>).
+ This setting lets you override individual settings coming from the
+ common <code class="inline-code">Configuration</code> object, depending on the name
+ (path) of the template.</p><p>It's important to understand, however, that this setting only
+ has effect if you get templates with
+ <code class="inline-code">Configuration.getTemplate(<em class="code-color">...</em>)</code>,
+ not when you create templates directly with the
+ <code class="inline-code">Template</code> constructors. In that case it's up to you
+ to invoke this mechanism (see <code class="inline-code">TemplateCache</code> source
+ code as an example).</p><p>You will use these kind of objects to declare your template
+ configuration rules:</p><ul>
+ <li>
+ <p><code class="inline-code">TemplateConfiguration</code>-s: These store the
+ actual setting assignments that you want to apply. For example,
+ this <code class="inline-code">TemplateConfiguration</code> will set the
+ encoding and the output format of the matched template (and leave
+ all other settings of it alone):</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">TemplateConfiguration tcUTF8XML = new TemplateConfiguration();
+tc.setEncoding("utf-8");
+tc.setOutputFormat(XMLOutputFormat.INSTANCE);</pre></div>
+ </li>
+
+ <li>
+ <p><code class="inline-code">TemplateSourceMatcher</code> (abstract)
+ subclasses: These define a rule that matches templates based on
+ their source name (their source path; as in
+ <code class="inline-code">Template.getSourceName()</code>), and possibly on
+ other <code class="inline-code">TemplateLoader</code>-dependent properties. For
+ example, <code class="inline-code">new FileExtensionMatcher("xml")</code>
+ matches templates that has <code class="inline-code">xml</code> file extension.
+ See all the subclasses in the Java API documentation.</p>
+ </li>
+
+ <li>
+ <p><code class="inline-code">TemplateConfigurationFactory</code>-es: This is
+ what connects <code class="inline-code">TemplateConfiguration</code>-s and
+ <code class="inline-code">TemplateSourceMatcher</code>-s together. This is the
+ Java type of the <code class="inline-code">template_configurations</code>
+ setting. See the examples below for more.</p>
+ </li>
+ </ul>
+
+
+
+
+<h2 class="content-header header-simplesect" id="autoid_47">Example 1</h2>
+
+
+ <p>This setup combines our earlier two example objects with a
+ <code class="inline-code">ConditionalTemplateConfigurationFactory</code>, causing
+ all templates with <code class="inline-code">xml</code> extension to get UTF-8
+ encoding and XML output format:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">cfg.setTemplateConfigurations(
+ new ConditionalTemplateConfigurationFactory(
+ new FileExtensionMatcher("xml"),
+ tcUTF8XML));</pre></div>
+
+ <p>The same configuring is also doable if you don't have access
+ to the configuring Java code, but only to a Java
+ <code class="inline-code">*.properties</code> file or other kind of string-string
+ key value pairs (the <code class="inline-code">\</code>-s are prescribed by the
+ Java Properties file format for multi-line values):</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">templateConfigurations = \
+ ConditionalTemplateConfigurationFactory( \
+ FileExtensionMatcher("xml"), \
+ TemplateConfiguration( \
+ encoding = "utf-8", \
+ outputFormat = XMLOutputFormat() \
+ ) \
+ )</pre></div>
+
+
+
+
+
+<h2 class="content-header header-simplesect" id="autoid_48">Example 2</h2>
+
+
+ <p>Let's say you only need to handle templates in the
+ <code class="inline-code">mail</code> directory specially, other templates can use
+ the setting coming from the shared <code class="inline-code">Configuration</code>
+ singleton. The names of templates there must contain
+ <code class="inline-code">".subject."</code> or <code class="inline-code">".body."</code>.
+ Subject templates must get <code class="inline-code">plainText</code> output
+ format, while body templates must get <code class="inline-code">HTML</code> output
+ format. So we have to make a choice here, and that's when you need a
+ <code class="inline-code">FirstMatchTemplateConfigurationFactory</code>.</p>
+
+ <p>Assuming <code class="inline-code">cfg</code> stores the shared
+ <code class="inline-code">Configuration</code> singleton, you set this up like
+ this:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">cfg.setTemplateConfigurations(
+ new ConditionalTemplateConfigurationFactory(
+ new PathGlobMatcher("mail/**"),
+ new FirstMatchTemplateConfigurationFactory(
+ new ConditionalTemplateConfigurationFactory(
+ new FileNameGlobMatcher("*.subject.*"),
+ tcSubject),
+ new ConditionalTemplateConfigurationFactory(
+ new FileNameGlobMatcher("*.body.*"),
+ tcBody)
+ )
+ .noMatchErrorDetails(
+ "Mail template names must contain \".subject.\" or \".body.\"!")
+ ));</pre></div>
+
+ <p>The equivalent configuration using a Java
+ <code class="inline-code">*.properties</code> file or other kind of string-string
+ key value pairs (the <code class="inline-code">\</code>-s are prescribed by the
+ Java Properties file format only):</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">templateConfigurations = \
+ ConditionalTemplateConfigurationFactory( \
+ PathGlobMatcher("mail/**"), \
+ FirstMatchTemplateConfigurationFactory( \
+ ConditionalTemplateConfigurationFactory( \
+ FileNameGlobMatcher("*.subject.*"), \
+ TemplateConfiguration(outputFormat = PlainTextOutputFormat()) \
+ ), \
+ ConditionalTemplateConfigurationFactory( \
+ FileNameGlobMatcher("*.body.*"), \
+ TemplateConfiguration(outputFormat = HTMLOutputFormat()) \
+ ), \
+ noMatchErrorDetails = 'Mail template names must contain ".subject." or ".body."!' \
+ ) \
+ )</pre></div>
+
+
+
+
+
+<h2 class="content-header header-simplesect" id="autoid_49">Example 3</h2>
+
+
+ <p>Let's say you want the following deviations from the shared
+ <code class="inline-code">Configuration</code> settings in your
+ application:</p>
+
+ <ul>
+ <li>
+ <p>All templates whose name contains
+ <code class="inline-code">".stats."</code> should use ISO date/time format and
+ UTC time zone</p>
+ </li>
+
+ <li>
+ <p>All templates inside the <code class="inline-code">mail</code> directory
+ should use UTF-8 encoding</p>
+ </li>
+
+ <li>
+ <p>Templates with <code class="inline-code">xml</code> file extension
+ should use XML <code class="inline-code">output_format</code>, templates with
+ <code class="inline-code">html</code> or <code class="inline-code">htm</code> extension
+ should use HTML output format. For other templates, the shared
+ <code class="inline-code">Configuration</code> can dictate the
+ <code class="inline-code">output_format</code>.</p>
+ </li>
+ </ul>
+
+ <p>Here we have 3 independent concerns, and possibly multiple (or
+ none) of those apply to a template; that's when you need a
+ <code class="inline-code">MergingTemplateConfigurationFactory</code>. The last
+ point describes a rule where you have mutually exclusive choices;
+ that's when you need a
+ <code class="inline-code">FirstMatchTemplateConfigurationFactory</code>, but this
+ time no choice is also allowed. Here's the source code, assuming
+ <code class="inline-code">cfg</code> stores the shared
+ <code class="inline-code">Configuration</code> instance:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">TemplateConfiguration tcStats = new TemplateConfiguration();
+tcStats.setDateTimeFormat("iso");
+tcStats.setDateFormat("iso");
+tcStats.setTimeFormat("iso");
+tcStats.setTimeZone(DateUtil.UTC);
+
+TemplateConfiguration tcMail = new TemplateConfiguration();
+tcMail.setEncoding("utf-8");
+
+TemplateConfiguration tcHTML = new TemplateConfiguration();
+tcHTML.setOutputFormat(HTMLOutputFormat.INSTANCE);
+
+TemplateConfiguration tcXML = new TemplateConfiguration();
+tcXML.setOutputFormat(XMLOutputFormat.INSTANCE);
+
+cfg.setTemplateConfigurations(
+ new MergingTemplateConfigurationFactory(
+ new ConditionalTemplateConfigurationFactory(
+ new FileNameGlobMatcher("*.stats.*"),
+ tcStats),
+ new ConditionalTemplateConfigurationFactory(
+ new PathGlobMatcher("mail/**"),
+ tcMail),
+ new FirstMatchTemplateConfigurationFactory(
+ new ConditionalTemplateConfigurationFactory(
+ new FileExtensionMatcher("xml"),
+ tcXML),
+ new ConditionalTemplateConfigurationFactory(
+ new OrMatcher(
+ new FileExtensionMatcher("html"),
+ new FileExtensionMatcher("htm")),
+ tcHTML)
+ ).allowNoMatch(true)
+ )
+);</pre></div>
+
+ <p>The equivalent configuration using a Java
+ <code class="inline-code">*.properties</code> file or other kind of string-string
+ key value pairs (the <code class="inline-code">\</code>-s are prescribed by the
+ Java Properties file format only):</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">templateConfigurations = \
+ MergingTemplateConfigurationFactory( \
+ ConditionalTemplateConfigurationFactory( \
+ FileNameGlobMatcher("*.stats.*"), \
+ TemplateConfiguration( \
+ dateTimeFormat = "iso", \
+ dateFormat = "iso", \
+ timeFormat = "iso", \
+ timeZone = TimeZone("UTC") \
+ ) \
+ ), \
+ ConditionalTemplateConfigurationFactory( \
+ PathGlobMatcher("mail/**"), \
+ TemplateConfiguration(encoding = "utf-8") \
+ ), \
+ FirstMatchTemplateConfigurationFactory( \
+ ConditionalTemplateConfigurationFactory( \
+ FileExtensionMatcher("xml"), \
+ TemplateConfiguration(outputFormat = XMLOutputFormat()) \
+ ), \
+ ConditionalTemplateConfigurationFactory( \
+ OrMatcher( \
+ FileExtensionMatcher("html"), \
+ FileExtensionMatcher("htm") \
+ ), \
+ TemplateConfiguration(outputFormat = HTMLOutputFormat()) \
+ ), \
+ allowNoMatch = true \
+ ) \
+ )</pre></div>
+ <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="pgui_config_errorhandling.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_outputformatsautoesc.html"><span>Next</span></a></div></div></div></div> </div>
+ </div>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href
="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p>
+<p class="copyright">
+� <span itemprop="copyrightYear">1999</span>\u20132017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
+</div></div></div></body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/pgui_config_templateloading.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/pgui_config_templateloading.html b/builds/2.3.26-nightly/pgui_config_templateloading.html
new file mode 100644
index 0000000..62595bb
--- /dev/null
+++ b/builds/2.3.26-nightly/pgui_config_templateloading.html
@@ -0,0 +1,364 @@
+<!doctype html>
+<!-- Generated by FreeMarker/Docgen from DocBook -->
+<html lang="en" class="page-type-section">
+<head prefix="og: http://ogp.me/ns#">
+<meta charset="utf-8">
+<title>Template loading - Apache FreeMarker Manual</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<meta name="format-detection" content="telephone=no">
+<meta property="og:site_name" content="Apache FreeMarker Manual">
+<meta property="og:title" content="Template loading">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/pgui_config_templateloading.html">
+<link rel="canonical" href="http://freemarker.org/docs/pgui_config_templateloading.html">
+<link rel="icon" href="favicon.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono">
+<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979">
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-55420501-1', 'auto');
+ga('send', 'pageview');
+</script>
+</head>
+<body itemscope itemtype="https://schema.org/Code">
+ <meta itemprop="url" content="http://freemarker.org/docs/">
+ <meta itemprop="name" content="Apache FreeMarker Manual">
+
+ <!--[if lte IE 9]>
+ <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div>
+ <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker">
+</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc
h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui.html"><span itemprop="name">Programmer's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config.html"><span itemprop="name">The Configuration</span></a></li><li class="step-3" itempr
op="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_config_templateloading.html"><span itemprop="name">Template loading</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width">
+ <div class="content-wrapper">
+ <div id="table-of-contents-wrapper" class="col-left">
+ <script>var breadcrumb = ["Apache FreeMarker Manual","Programmer\'s Guide","The Configuration","Template loading"];</script>
+ <script src="toc.js?1489402528979"></script>
+ <script src="docgen-resources/main.min.js?1489402528979"></script>
+ </div>
+<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="pgui_config_settings.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_errorhandling.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="pgui_config_templateloading" itemprop="headline">Template loading</h1>
+</div></div><div class="page-menu">
+<div class="page-menu-title">Page Contents</div>
+<ul><li><a class="page-menu-link" href="#autoid_38" data-menu-target="autoid_38">Template loaders</a><ul><li><a class="page-menu-link" href="#autoid_39" data-menu-target="autoid_39">Built-in template loaders</a></li><li><a class="page-menu-link" href="#autoid_40" data-menu-target="autoid_40">Loading templates from multiple locations</a></li><li><a class="page-menu-link" href="#autoid_41" data-menu-target="autoid_41">Loading templates from other sources</a></li><li><a class="page-menu-link" href="#autoid_42" data-menu-target="autoid_42">The template name (template path)</a></li></ul></li><li><a class="page-menu-link" href="#pgui_config_templateloading_caching" data-menu-target="pgui_config_templateloading_caching">Template caching</a></li></ul> </div>
+
+
+
+
+<h2 class="content-header header-section2" id="autoid_38">Template loaders</h2>
+
+
+
+
+ <p>Template loaders are objects that load raw textual data based
+ on abstract template paths like <code class="inline-code">"index.ftl"</code> or
+ <code class="inline-code">"products/catalog.ftl"</code>. It's up to the concrete
+ template loader if from where and how the template
+ "files" are loaded. They could be real files inside a
+ specified directory, or values in a data base table, or
+ <code class="inline-code">String</code>-s in a Java Map, etc. When you call
+ <code class="inline-code">cfg.getTemplate</code> (where <code class="inline-code">cfg</code> is
+ a <code class="inline-code">Configuration</code> instance), FreeMarker asks the
+ template loader (<code class="inline-code">cfg.getTemplateLoader</code>) to return
+ the text for the given template path, and then FreeMarker parses
+ that text as template. It doesn't care or even know if the template
+ is a real file or not, and where it is physically; those details are
+ only known by the template loader.</p>
+
+
+
+
+
+
+<h3 class="content-header header-section3" id="autoid_39">Built-in template loaders</h3>
+
+
+ <p>You can set up the three most common template loading
+ mechanism in the <code class="inline-code">Configuration</code> using the
+ following <em>convenience</em> methods:</p>
+
+ <ul>
+ <li>
+ <p><code class="inline-code">void setDirectoryForTemplateLoading(File
+ dir)</code>: Sets a directory on the file system from which
+ to load templates. Template names (template paths) will be
+ interpreted relatively to this physical directory. It won't
+ let you load files outside this directory.</p>
+ </li>
+
+ <li>
+ <p><code class="inline-code">void setClassForTemplateLoading(Class cl,
+ String basePackagePath)</code> and <code class="inline-code">void
+ setClassLoaderForTemplateLoading(ClassLoader classLoader,
+ String basePackagePath)</code>: These are for when you want
+ to load templates via the same mechanism with which Java loads
+ classes (from the class-path, as they used to say vaguely).
+ This is very likely be the preferred means of loading
+ templates for production code, as it allows you to keep
+ everything inside the deployment <code class="inline-code">jar</code> files.
+ The first parameter decides which Java
+ <code class="inline-code">ClassLoader</code> will be used. The second
+ parameter specifies the package that contains the templates,
+ in <code class="inline-code">/</code>-separated format. Note that if you
+ don't start it with <code class="inline-code">/</code>, it will be
+ interpreted relatively to the package of the
+ <code class="inline-code">Class</code> parameter.</p>
+ </li>
+
+ <li>
+ <p><code class="inline-code">void setServletContextForTemplateLoading(Object
+ servletContext, String path)</code>: Takes the context of
+ your Servlet-based web application, and a base path, which is
+ interpreted relative to the web application root directory
+ (that's the parent of the <code class="inline-code">WEB-INF</code>
+ directory). Note that we refer to "directory" here although
+ this loading method works even for unpacked
+ <code class="inline-code">.war</code> files, since it uses
+ <code class="inline-code">ServletContext.getResource()</code> to access the
+ templates. If you omit the second parameter (or use
+ <code class="inline-code">""</code>), you can simply store the static files
+ (<code class="inline-code">.html</code>, <code class="inline-code">.jpg</code>, etc.)
+ mixed with the <code class="inline-code">.ftl</code> files. Of course, you
+ must set up a Servlet for the <code class="inline-code">*.ftl</code>,
+ <code class="inline-code">*.ftlh</code>, <code class="inline-code">*.ftlx</code>
+ uri-patterns in <code class="inline-code">WEB-INF/web.xml</code> for this,
+ otherwise the client will get the raw templates as is! To
+ avoid a such accident, many prefers storing the templates
+ somewhere inside the <code class="inline-code">WEB-INF</code> directory,
+ which is never visitable directly. This mechanism will very
+ likely be the preferred means of loading templates for servlet
+ applications, since the templates can be updated without
+ restarting the web application, while this often doesn't work
+ with the class-loader mechanism.</p>
+ </li>
+ </ul>
+
+ <p>If you want to use a custom
+ <code class="inline-code">TemplateLoader</code> implementation, or need to set
+ up some extra settings of a built-in template loader, you need to
+ instantiate the <code class="inline-code">TemplateLoader</code> object yourself,
+ and then call
+ <code class="inline-code">Configuration.setTemplateLoader(TemplateLoader)</code>:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">WebappTemplateLoader templateLoader = new WebappTemplateLoader(servletContext, "WEB-INF/templates");
+templateLoader.setURLConnectionUsesCaches(false);
+templateLoader.setAttemptFileAccess(false);
+cfg.setTemplateLoader(templateLoader);</pre></div>
+
+
+
+
+
+
+
+<h3 class="content-header header-section3" id="autoid_40">Loading templates from multiple locations</h3>
+
+
+ <p>If you need to load templates from multiple locations, you
+ have to instantiate the template loader objects for every
+ location, wrap them into a <code class="inline-code">MultiTemplateLoader</code>,
+ and finally pass that loader to the
+ <code class="inline-code">setTemplateLoader(TemplateLoader loader)</code> method
+ of <code class="inline-code">Configuration</code>. Here's an example for loading
+ templates from two distinct directories and with the
+ class-loader:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">import freemarker.cache.*; // template loaders live in this package
+
+<em>...</em>
+
+FileTemplateLoader ftl1 = new FileTemplateLoader(new File("/tmp/templates"));
+FileTemplateLoader ftl2 = new FileTemplateLoader(new File("/usr/data/templates"));
+ClassTemplateLoader ctl = new ClassTemplateLoader(getClass(), "/com/example/templates");
+
+MultiTemplateLoader mtl = new MultiTemplateLoader(new TemplateLoader[] { ftl1, ftl2, ctl });
+
+cfg.setTemplateLoader(mtl);</pre></div>
+
+ <p>Now FreeMarker will try to load templates from
+ <code class="inline-code">/tmp/templates</code> directory, and if it does not
+ find the requested template there, it will try to load that from
+ <code class="inline-code">/usr/data/templates</code>, and if it still does not
+ find the requested template, then it tries to load it from the
+ <code class="inline-code">com.example.templates</code> Java package.</p>
+
+
+
+
+
+
+
+<h3 class="content-header header-section3" id="autoid_41">Loading templates from other sources</h3>
+
+
+ <p>If none of the built-in class loaders fit your needs, you
+ can write your own class that implements the
+ <code class="inline-code">freemarker.cache.TemplateLoader</code> interface and
+ pass it to the <code class="inline-code">setTemplateLoader(TemplateLoader
+ loader)</code> method of <code class="inline-code">Configuration</code>.
+ Please read the API JavaDoc for more information.</p>
+
+ <p>If your template source accesses the templates through an
+ URL, you needn't implement a <code class="inline-code">TemplateLoader</code>
+ from scratch; you can choose to subclass
+ <code class="inline-code">freemarker.cache.URLTemplateLoader</code> instead and
+ just implement the <code class="inline-code">URL getURL(String
+ templateName)</code> method.</p>
+
+
+
+
+
+
+
+<h3 class="content-header header-section3" id="autoid_42">The template name (template path)</h3>
+
+
+
+
+
+
+
+
+ <p>It is up to the template loader how it interprets template
+ names (also known as template paths). But to work together with
+ other components there are restrictions regarding the format of
+ the path. In general, it is strongly recommended that template
+ loaders use URL-style paths. The path must not use
+ <code class="inline-code">/</code> (path step separator) character, nor the
+ <code class="inline-code">.</code> (same-directory) and <code class="inline-code">..</code>
+ (parent directory) path steps with other meaning than they have in
+ URL paths (or in UN*X paths). The <code class="inline-code">*</code> (asterisk)
+ step is also reserved, and used for "template
+ acquisition" feature of FreeMarker.</p>
+
+ <p><code class="inline-code">://</code> (or with
+ <code class="inline-code">template_name_format</code> setting set to
+ <code class="inline-code">DEFAULT_2_4_0</code>, the <code class="inline-code">:</code> (colon)
+ character) is reserved for specifying a scheme part, similarly as
+ it works with URI-s. For example
+ <code class="inline-code">someModule://foo/bar.ftl</code> uses the
+ <code class="inline-code">someModule</code>, or assuming the
+ <code class="inline-code">DEFAULT_2_4_0</code> format,
+ <code class="inline-code">classpath:foo/bar.ftl</code> uses the
+ <code class="inline-code">classpath</code> scheme. Interpreting the scheme part
+ is completely up to the <code class="inline-code">TemplateLoader</code>. (The
+ FreeMarker core is only aware of the idea of schemes because
+ otherwise it couldn't resolve relative template names
+ properly.)</p>
+
+ <p>FreeMarker always normalizes the paths before passing them
+ to the <code class="inline-code">TemplateLoader</code>, so the paths don't
+ contain <code class="inline-code">/../</code> or such, and are relative to the
+ imaginary template root directory (that is, they don't start with
+ <code class="inline-code">/</code>). They don't contain the <code class="inline-code">*</code>
+ step either, as template acquisition happens in an earlier stage.
+ Furthermore, with <code class="inline-code">template_name_format</code> setting
+ set to <code class="inline-code">DEFAULT_2_4_0</code>, multiple consecutive
+ <code class="inline-code">/</code>-s will be normalized to a single
+ <code class="inline-code">/</code> (unless they are part of the
+ <code class="inline-code">://</code> scheme separator).</p>
+
+ <p>Note that FreeMarker template path should always uses slash
+ (not backslash) regardless of the host OS.</p>
+
+
+
+
+
+
+<h2 class="content-header header-section2" id="pgui_config_templateloading_caching">Template caching</h2>
+
+
+
+
+
+
+ <p>FreeMarker caches templates (assuming you use the
+ <code class="inline-code">Configuration</code> methods to create
+ <code class="inline-code">Template</code> objects). This means that when you call
+ <code class="inline-code">getTemplate</code>, FreeMarker not only returns the
+ resulting <code class="inline-code">Template</code> object, but stores it in a
+ cache, so when next time you call <code class="inline-code">getTemplate</code>
+ with the same (or equivalent) path, it just returns the cached
+ <code class="inline-code">Template</code> instance, and will not load and parse
+ the template file again.</p>
+
+ <p>If you change the template file, then FreeMarker will re-load
+ and re-parse the template automatically when you get the template
+ next time. However, since always checking for changes can be burden
+ for a system that processes lot of templates, there is a
+ <code class="inline-code">Configuration</code> level setting called "update
+ delay" (defaults is 5 seconds). Until this much time has
+ elapsed since the last checking for a newer version, FreeMarker will
+ not check again if the template was changed. If you want to see the
+ changes without delay, set this setting to 0. Note that some
+ template loaders won't see that a template was changed because of
+ the underlying storage mechanism doesn't support that; for example,
+ class-loader based template loaders may have this problem.</p>
+
+ <p>A template will be removed from the cache if you call
+ <code class="inline-code">getTemplate</code> and FreeMarker realizes that the
+ template file has been removed meanwhile. Also, if the JVM thinks
+ that it begins to run out of memory, by default it can arbitrarily
+ drop templates from the cache. Furthermore, you can empty the cache
+ manually with the <code class="inline-code">clearTemplateCache</code> method of
+ <code class="inline-code">Configuration</code>. You can also drop selected
+ template from the cache with
+ <code class="inline-code">removeTemplateFromCache</code>; this can be also
+ utilized to force re-loading a template regardless of the
+ "update delay" setting.</p>
+
+ <p>The actual strategy of when a cached template should be thrown
+ away is pluggable with the <code class="inline-code">cache_storage</code> setting,
+ by which you can plug any <code class="inline-code">CacheStorage</code>
+ implementation. For most users
+ <code class="inline-code">freemarker.cache.MruCacheStorage</code> will be
+ sufficient. This cache storage implements a two-level Most Recently
+ Used cache. In the first level, items are strongly referenced up to
+ the specified maximum (strongly referenced items can't be dropped by
+ the JVM, as opposed to softly referenced items). When the maximum is
+ exceeded, the least recently used item is moved into the second
+ level cache, where they are softly referenced, up to another
+ specified maximum. The size of the strong and soft parts can be
+ specified with the constructor. For example, set the size of the
+ strong part to 20, and the size of soft part to 250:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">cfg.setCacheStorage(new freemarker.cache.MruCacheStorage(20, 250))</pre></div>
+
+ <p>Or, since <code class="inline-code">MruCacheStorage</code> is the default
+ cache storage implementation:</p>
+
+
+
+<div class="code-wrapper"><pre class="code-block code-unspecified">cfg.setSetting(Configuration.CACHE_STORAGE_KEY, "strong:20, soft:250");</pre></div>
+
+ <p>When you create a new <code class="inline-code">Configuration</code> object,
+ initially it uses an <code class="inline-code">MruCacheStorage</code> where
+ <code class="inline-code">strongSizeLimit</code> is 0, and
+ <code class="inline-code">softSizeLimit</code> is
+ <code class="inline-code">Integer.MAX_VALUE</code> (that is, in practice,
+ infinite). Depending on how smart the JVM is, using non-0
+ <code class="inline-code">strongSizeLimit</code> is maybe a safer option, as with
+ only softly referenced items the JVM could even throw the most
+ frequently used templates when there's a resource shortage, which
+ then have to be re-loaded and re-parsed, burdening the system even
+ more.</p>
+ <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="pgui_config_settings.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_config_errorhandling.html"><span>Next</span></a></div></div></div></div> </div>
+ </div>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href
="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p>
+<p class="copyright">
+� <span itemprop="copyrightYear">1999</span>\u20132017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
+</div></div></div></body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/pgui_datamodel.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/pgui_datamodel.html b/builds/2.3.26-nightly/pgui_datamodel.html
new file mode 100644
index 0000000..d660cee
--- /dev/null
+++ b/builds/2.3.26-nightly/pgui_datamodel.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<!-- Generated by FreeMarker/Docgen from DocBook -->
+<html lang="en" class="page-type-chapter">
+<head prefix="og: http://ogp.me/ns#">
+<meta charset="utf-8">
+<title>The Data Model - Apache FreeMarker Manual</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<meta name="format-detection" content="telephone=no">
+<meta property="og:site_name" content="Apache FreeMarker Manual">
+<meta property="og:title" content="The Data Model">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/pgui_datamodel.html">
+<link rel="canonical" href="http://freemarker.org/docs/pgui_datamodel.html">
+<link rel="icon" href="favicon.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono">
+<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979">
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-55420501-1', 'auto');
+ga('send', 'pageview');
+</script>
+</head>
+<body itemscope itemtype="https://schema.org/Code">
+ <meta itemprop="url" content="http://freemarker.org/docs/">
+ <meta itemprop="name" content="Apache FreeMarker Manual">
+
+ <!--[if lte IE 9]>
+ <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div>
+ <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker">
+</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc
h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui.html"><span itemprop="name">Programmer's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_datamodel.html"><span itemprop="name">The Data Model</span></a></li></ul><div class="bookmark
s" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width">
+ <div class="content-wrapper">
+ <div id="table-of-contents-wrapper" class="col-left">
+ <script>var breadcrumb = ["Apache FreeMarker Manual","Programmer\'s Guide","The Data Model"];</script>
+ <script src="toc.js?1489402528979"></script>
+ <script src="docgen-resources/main.min.js?1489402528979"></script>
+ </div>
+<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="pgui_quickstart_all.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_datamodel_basics.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-chapter" id="pgui_datamodel" itemprop="headline">The Data Model</h1>
+</div></div><div class="page-menu">
+<div class="page-menu-title">Section Contents</div>
+<ul><li><a class="page-menu-link" href="pgui_datamodel_basics.html" data-menu-target="pgui_datamodel_basics">Basics</a></li><li><a class="page-menu-link" href="pgui_datamodel_scalar.html" data-menu-target="pgui_datamodel_scalar">Scalars</a></li><li><a class="page-menu-link" href="pgui_datamodel_parent.html" data-menu-target="pgui_datamodel_parent">Containers</a></li><li><a class="page-menu-link" href="pgui_datamodel_method.html" data-menu-target="pgui_datamodel_method">Methods</a></li><li><a class="page-menu-link" href="pgui_datamodel_directive.html" data-menu-target="pgui_datamodel_directive">Directives</a></li><li><a class="page-menu-link" href="pgui_datamodel_node.html" data-menu-target="pgui_datamodel_node">Node variables</a></li><li><a class="page-menu-link" href="pgui_datamodel_objectWrapper.html" data-menu-target="pgui_datamodel_objectWrapper">Object wrappers</a></li></ul> </div><p>This is just an introductory explanation. See the <a href="api/index.html">FreeMarker Java API
documentation</a> for more
+ detailed information.</p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="pgui_quickstart_all.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_datamodel_basics.html"><span>Next</span></a></div></div></div></div> </div>
+ </div>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href
="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p>
+<p class="copyright">
+� <span itemprop="copyrightYear">1999</span>\u20132017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
+</div></div></div></body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/pgui_datamodel_basics.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/pgui_datamodel_basics.html b/builds/2.3.26-nightly/pgui_datamodel_basics.html
new file mode 100644
index 0000000..eae2c70
--- /dev/null
+++ b/builds/2.3.26-nightly/pgui_datamodel_basics.html
@@ -0,0 +1,105 @@
+<!doctype html>
+<!-- Generated by FreeMarker/Docgen from DocBook -->
+<html lang="en" class="page-type-section">
+<head prefix="og: http://ogp.me/ns#">
+<meta charset="utf-8">
+<title>Basics - Apache FreeMarker Manual</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<meta name="format-detection" content="telephone=no">
+<meta property="og:site_name" content="Apache FreeMarker Manual">
+<meta property="og:title" content="Basics">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/pgui_datamodel_basics.html">
+<link rel="canonical" href="http://freemarker.org/docs/pgui_datamodel_basics.html">
+<link rel="icon" href="favicon.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono">
+<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979">
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-55420501-1', 'auto');
+ga('send', 'pageview');
+</script>
+</head>
+<body itemscope itemtype="https://schema.org/Code">
+ <meta itemprop="url" content="http://freemarker.org/docs/">
+ <meta itemprop="name" content="Apache FreeMarker Manual">
+
+ <!--[if lte IE 9]>
+ <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div>
+ <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker">
+</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc
h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui.html"><span itemprop="name">Programmer's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_datamodel.html"><span itemprop="name">The Data Model</span></a></li><li class="step-3" itempr
op="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="pgui_datamodel_basics.html"><span itemprop="name">Basics</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width">
+ <div class="content-wrapper">
+ <div id="table-of-contents-wrapper" class="col-left">
+ <script>var breadcrumb = ["Apache FreeMarker Manual","Programmer\'s Guide","The Data Model","Basics"];</script>
+ <script src="toc.js?1489402528979"></script>
+ <script src="docgen-resources/main.min.js?1489402528979"></script>
+ </div>
+<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="pgui_datamodel.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_datamodel_scalar.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="pgui_datamodel_basics" itemprop="headline">Basics</h1>
+</div></div><p>You have seen how to build a data-model in the <a href="pgui_quickstart.html">Getting Started</a> using the standard
+ Java classes (<code class="inline-code">Map</code>, <code class="inline-code">String</code>,
+ etc.). Internally, the variables available in the template are Java
+ objects that implement the
+ <code class="inline-code">freemarker.template.TemplateModel</code> interface. But
+ you could use standard Java collections as variables in your
+ data-model, because these were replaced with the appropriate
+ <code class="inline-code">TemplateModel</code> instances behind the scenes. This
+ facility is called <strong>object wrapping</strong>.
+ The object wrapping facility can convert <em>any</em> kind
+ of object transparently to the instances of classes that implement
+ <code class="inline-code">TemplateModel</code> interface. This makes it possible,
+ for example, to access <code class="inline-code">java.sql.ResultSet</code> as
+ sequence variable in templates, or to access
+ <code class="inline-code">javax.servlet.ServletRequest</code> objects as a hash
+ variable that contains the request attributes, or even to traverse XML
+ documents as FTL variables (<a href="xgui.html">see here</a>). To
+ wrap (convert) these objects, however, you need to plug the proper
+ <code class="inline-code">ObjectWrapper</code> implementation (possibly your custom
+ implementation); this will be discussed <a href="pgui_datamodel_objectWrapper.html">later</a>. The point for now
+ is that any object that you want to access from the templates, sooner
+ or later must be converted to an object that implements
+ <code class="inline-code">TemplateModel</code> interface. So first you should
+ familiarize yourself with writing of <code class="inline-code">TemplateModel</code>
+ implementations.</p><p>There is roughly one
+ <code class="inline-code">freemarker.template.TemplateModel</code> descendant
+ interface corresponding to each basic type of variable
+ (<code class="inline-code">TemplateHashModel</code> for hashes,
+ <code class="inline-code">TemplateSequenceModel</code> sequences,
+ <code class="inline-code">TemplateNumberModel</code> for numbers, etc.). For
+ example, if you want to expose a <code class="inline-code">java.sql.ResultSet</code>
+ as a sequence for the templates, then you have to write a
+ <code class="inline-code">TemplateSequenceModel</code> implementation that can read
+ <code class="inline-code">java.sql.ResultSet</code>-s. We used to say on this, that
+ you <em>wrap</em> the
+ <code class="inline-code">java.sql.ResultSet</code> with your
+ <code class="inline-code">TemplateModel</code> implementation, as basically you just
+ encapsulate the <code class="inline-code">java.sql.ResultSet</code> to provide
+ access to it with the common <code class="inline-code">TemplateSequenceModel</code>
+ interface. Note that a class can implement multiple
+ <code class="inline-code">TemplateModel</code> interfaces; this is why FTL variables
+ can have multiple types (see: <a href="dgui_datamodel_basics.html">Template Author's Guide/Values, Types/Basics</a>)</p><p>Note that a trivial implementation of these interfaces is
+ provided with the <code class="inline-code">freemarker.template</code> package. For
+ example, to convert a <code class="inline-code">String</code> to FTL string
+ variable, you can use <code class="inline-code">SimpleScalar</code>, to convert a
+ <code class="inline-code">java.util.Map</code> to FTL hash variable, you can use
+ <code class="inline-code">SimpleHash</code>, etc.</p><p>An easy way to try your own <code class="inline-code">TemplateModel</code>
+ implementation, is to create an instance of that, and drop it directly
+ into the data-model (as <code class="inline-code">put</code> it into the root hash).
+ The object wrapper will expose it untouched for the template, as it
+ already implements <code class="inline-code">TemplateModel</code>, so no conversion
+ (wrapping) needed. (This trick is also useful in cases when you do not
+ want the object wrapper to try to wrap (convert) a certain
+ object.)</p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="pgui_datamodel.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui_datamodel_scalar.html"><span>Next</span></a></div></div></div></div> </div>
+ </div>
+<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href
="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated">
+Last generated:
+<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p>
+<p class="copyright">
+� <span itemprop="copyrightYear">1999</span>\u20132017
+<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p>
+</div></div></div></body>
+</html>