| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_281) on Sun Jan 15 15:58:33 CET 2023 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>TemplateNameFormat (FreeMarker 2.3.32 API)</title> |
| <meta name="date" content="2023-01-15"> |
| <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="TemplateNameFormat (FreeMarker 2.3.32 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/TemplateNameFormat.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../freemarker/cache/TemplateLookupStrategy.html" title="class in freemarker.cache"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../freemarker/cache/TemplateSourceMatcher.html" title="class in freemarker.cache"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?freemarker/cache/TemplateNameFormat.html" target="_top">Frames</a></li> |
| <li><a href="TemplateNameFormat.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li>Method</li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">freemarker.cache</div> |
| <h2 title="Class TemplateNameFormat" class="title">Class TemplateNameFormat</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>freemarker.cache.TemplateNameFormat</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public abstract class <span class="typeNameLabel">TemplateNameFormat</span> |
| extends java.lang.Object</pre> |
| <div class="block">Symbolizes a template name format, which defines the basic syntax of names through algorithms such as normalization. |
| The API of this class isn't exposed as it's too immature, so custom template name formats aren't possible yet.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="../../freemarker/cache/TemplateNameFormat.html" title="class in freemarker.cache">TemplateNameFormat</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/cache/TemplateNameFormat.html#DEFAULT_2_3_0">DEFAULT_2_3_0</a></span></code> |
| <div class="block">The default template name format when <a href="../../freemarker/template/Configuration.html#Configuration-freemarker.template.Version-"><code>incompatible_improvements</code></a> is |
| below 2.4.0.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../freemarker/cache/TemplateNameFormat.html" title="class in freemarker.cache">TemplateNameFormat</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/cache/TemplateNameFormat.html#DEFAULT_2_4_0">DEFAULT_2_4_0</a></span></code> |
| <div class="block">The default template name format only when <a href="../../freemarker/template/Configuration.html#Configuration-freemarker.template.Version-"><code>incompatible_improvements</code></a> |
| is set to 2.4.0 (or higher).</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="DEFAULT_2_3_0"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEFAULT_2_3_0</h4> |
| <pre>public static final <a href="../../freemarker/cache/TemplateNameFormat.html" title="class in freemarker.cache">TemplateNameFormat</a> DEFAULT_2_3_0</pre> |
| <div class="block">The default template name format when <a href="../../freemarker/template/Configuration.html#Configuration-freemarker.template.Version-"><code>incompatible_improvements</code></a> is |
| below 2.4.0. As of FreeMarker 2.4.0, the default <code>incompatible_improvements</code> is still <code>2.3.0</code>, and it |
| will certainly remain so for a very long time. In new projects it's highly recommended to use |
| <a href="../../freemarker/cache/TemplateNameFormat.html#DEFAULT_2_4_0"><code>DEFAULT_2_4_0</code></a> instead.</div> |
| </li> |
| </ul> |
| <a name="DEFAULT_2_4_0"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DEFAULT_2_4_0</h4> |
| <pre>public static final <a href="../../freemarker/cache/TemplateNameFormat.html" title="class in freemarker.cache">TemplateNameFormat</a> DEFAULT_2_4_0</pre> |
| <div class="block">The default template name format only when <a href="../../freemarker/template/Configuration.html#Configuration-freemarker.template.Version-"><code>incompatible_improvements</code></a> |
| is set to 2.4.0 (or higher). This is not the out-of-the-box default format of FreeMarker 2.4.x, because the |
| default <code>incompatible_improvements</code> is still 2.3.0 there. |
| |
| <p> |
| Differences to the <a href="../../freemarker/cache/TemplateNameFormat.html#DEFAULT_2_3_0"><code>DEFAULT_2_3_0</code></a> format: |
| |
| <ul> |
| |
| <li>The scheme and the path need not be separated with <code>"://"</code> anymore, only with <code>":"</code>. This makes |
| template names like <code>"classpath:foo.ftl"</code> interpreted as an absolute name with scheme <code>"classpath"</code> |
| and absolute path "foo.ftl". The scheme name before the <code>":"</code> can't contain <code>"/"</code>, or else it's |
| treated as a malformed name. The scheme part can be separated either with <code>"://"</code> or just <code>":"</code> from |
| the path. Hence, <code>myscheme:/x</code> is normalized to <code>myscheme:x</code>, while <code>myscheme:///x</code> is |
| normalized to <code>myscheme://x</code>, but <code>myscehme://x</code> or <code>myscheme:/x</code> aren't changed by |
| normalization. It's up the <a href="../../freemarker/cache/TemplateLoader.html" title="interface in freemarker.cache"><code>TemplateLoader</code></a> to which the normalized names are passed to decide which of |
| these scheme separation conventions are valid (maybe both).</li> |
| |
| <li><code>":"</code> is not allowed in template names, except as the scheme separator (see previous point). |
| |
| <li>Malformed paths throw <a href="../../freemarker/template/MalformedTemplateNameException.html" title="class in freemarker.template"><code>MalformedTemplateNameException</code></a> instead of acting like if the template wasn't |
| found. |
| |
| <li><code>"\"</code> (backslash) is not allowed in template names, and causes <a href="../../freemarker/template/MalformedTemplateNameException.html" title="class in freemarker.template"><code>MalformedTemplateNameException</code></a>. |
| With <a href="../../freemarker/cache/TemplateNameFormat.html#DEFAULT_2_3_0"><code>DEFAULT_2_3_0</code></a> you would certainly end up with a <a href="../../freemarker/template/TemplateNotFoundException.html" title="class in freemarker.template"><code>TemplateNotFoundException</code></a> (or worse, |
| it would work, but steps like <code>".."</code> wouldn't be normalized by FreeMarker). |
| |
| <li>Template names might end with <code>/</code>, like <code>"foo/"</code>, and the presence or lack of the terminating |
| <code>/</code> is seen as significant. While their actual interpretation is up to the <a href="../../freemarker/cache/TemplateLoader.html" title="interface in freemarker.cache"><code>TemplateLoader</code></a>, |
| operations that manipulate template names assume that the last step refers to a "directory" as opposed to a |
| "file" exactly if the terminating <code>/</code> is present. Except, the empty name is assumed to refer to the root |
| "directory" (despite that it doesn't end with <code>/</code>). |
| |
| <li><code>//</code> is normalized to <code>/</code>, except of course if it's in the scheme name terminator. Like |
| <code>foo//bar///baaz.ftl</code> is normalized to <code>foo/bar/baaz.ftl</code>. (In general, 0 long step names aren't |
| possible anymore.)</li> |
| |
| <li>The <code>".."</code> bugs of the legacy normalizer are fixed: <code>".."</code> steps has removed the preceding |
| <code>"."</code> or <code>"*"</code> or scheme steps, not treating them specially as they should be. Now these work as |
| expected. Examples: <code>"a/./../c"</code> has become to <code>"a/c"</code>, now it will be <code>"c"</code>; <code>"a/b/*</code> |
| <code>/../c"</code> has become to <code>"a/b/c"</code>, now it will be <code>"a/*</code><code>/c"</code>; <code>"scheme://.."</code> has |
| become to <code>"scheme:/"</code>, now it will be <code>null</code> (<a href="../../freemarker/template/TemplateNotFoundException.html" title="class in freemarker.template"><code>TemplateNotFoundException</code></a>) for backing out of |
| the root directory.</li> |
| |
| <li>As now directory paths has to be handled as well, it recognizes terminating, leading, and lonely <code>".."</code> |
| and <code>"."</code> steps. For example, <code>"foo/bar/.."</code> now becomes to <code>"foo/"</code></li> |
| |
| <li>Multiple consecutive <code>*</code> steps are normalized to one</li> |
| |
| </ul></div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/TemplateNameFormat.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../freemarker/cache/TemplateLookupStrategy.html" title="class in freemarker.cache"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../freemarker/cache/TemplateSourceMatcher.html" title="class in freemarker.cache"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?freemarker/cache/TemplateNameFormat.html" target="_top">Frames</a></li> |
| <li><a href="TemplateNameFormat.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li>Method</li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |