public abstract class TemplateNameFormat extends Object
|Modifier and Type||Field and Description|
The default template name format when
The default template name format only when
public static final TemplateNameFormat DEFAULT_2_3_0
public static final TemplateNameFormat DEFAULT_2_4_0
incompatible_improvementsis 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
incompatible_improvementsis still 2.3.0 there.
Differences to the
"://"anymore, only with
":". This makes template names like
"classpath:foo.ftl"interpreted as an absolute name with scheme
"classpath"and absolute path "foo.ftl". The scheme name before the
"/", or else it's treated as a malformed name. The scheme part can be separated either with
":"from the path. Hence,
myschme:/xis normalized to
myschme:///xis normalized to
myschme:/xaren't changed by normalization. It's up the
TemplateLoaderto which the normalized names are passed to decide which of these scheme separation conventions are valid (maybe both).
":"is not allowed in template names, except as the scheme separator (see previous point).
MalformedTemplateNameExceptioninstead of acting like if the template wasn't found.
"\"(backslash) is not allowed in template names, and causes
DEFAULT_2_3_0you would certainly end up with a
TemplateNotFoundException(or worse, it would work, but steps like
".."wouldn't be normalized by FreeMarker).
"foo/", and the presence or lack of the terminating
/is seen as significant. While their actual interpretation is up to the
TemplateLoader, operations that manipulate template names assume that the last step refers to a "directory" as opposed to a "file" exactly if the terminating
/is present. Except, the empty name is assumed to refer to the root "directory" (despite that it doesn't end with
//is normalized to
/, except of course if it's in the scheme name terminator. Like
foo//bar///baaz.ftlis normalized to
foo/bar/baaz.ftl. (In general, 0 long step names aren't possible anymore.)
".."bugs of the legacy normalizer are fixed:
".."steps has removed the preceding
"*"or scheme steps, not treating them specially as they should be. Now these work as expected. Examples:
"a/./../c"has become to
"a/c", now it will be
/../c"has become to
"a/b/c", now it will be
"scheme://.."has become to
"scheme:/", now it will be
TemplateNotFoundException) for backing out of the root directory.
"."steps. For example,
"foo/bar/.."now becomes to
*steps are normalized to one