Java Doc for Configuration.java in  » Template-Engine » freemarker-2.3.10 » freemarker » template » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » freemarker 2.3.10 » freemarker.template 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   freemarker.core.Configurable
      freemarker.template.Configuration

Configuration
public class Configuration extends Configurable implements Cloneable(Code)
Main entry point into the FreeMarker API, this class encapsulates the various configuration parameters with which FreeMarker is run, as well as serves as a central template loading and caching point. Note that this class uses a default strategy for loading and caching templates. You can plug in a replacement template loading mechanism by using the Configuration.setTemplateLoader(TemplateLoader) method. This object is not synchronized. Thus, the settings must not be changed after you have started to access the object from multiple threads. If you use multiple threads, set everything directly after you have instantiated the Configuration object, and don't change the settings anymore.
author:
   Jonathan Revusky
author:
   Attila Szegedi
version:
   $Id: Configuration.java,v 1.122.2.5 2006/04/26 21:25:19 ddekany Exp $


Field Summary
final public static  intANGLE_BRACKET_TAG_SYNTAX
    
final public static  intAUTO_DETECT_TAG_SYNTAX
    
final public static  StringAUTO_IMPORT_KEY
    
final public static  StringAUTO_INCLUDE_KEY
    
final public static  StringCACHE_STORAGE_KEY
    
final public static  StringDEFAULT_ENCODING_KEY
    
final public static  StringLOCALIZED_LOOKUP_KEY
    
final public static  intSQUARE_BRACKET_TAG_SYNTAX
    
final public static  StringSTRICT_SYNTAX_KEY
    
final public static  StringTAG_SYNTAX_KEY
    
final public static  StringTEMPLATE_UPDATE_DELAY_KEY
    
final public static  StringWHITESPACE_STRIPPING_KEY
    

Constructor Summary
public  Configuration()
    

Method Summary
public synchronized  voidaddAutoImport(String namespace, String template)
     Add an auto-imported template.
public synchronized  voidaddAutoInclude(String templateName)
     add a template to be automatically included at the top of any template that is vended by this Configuration object.
public  voidclearEncodingMap()
     Clears language-to-encoding map.
public  voidclearSharedVariables()
     Removes all shared variables, except the predefined ones (compress, html_escape, etc.).
public  voidclearTemplateCache()
     Removes all entries from the template cache, thus forcing reloading of templates on subsequent getTemplate calls.
public  Objectclone()
    
 voiddoAutoImports(Environment env)
    
 voiddoAutoIncludes(Environment env)
    
public static  ConfigurationgetDefaultConfiguration()
     Returns the default (singleton) Configuration object.
public  StringgetDefaultEncoding()
     Gets the default encoding for converting bytes to characters when reading template files in a locale for which no explicit encoding was specified.
public  StringgetEncoding(Locale loc)
     Gets the preferred character encoding for the given locale, or the default encoding if no encoding is set explicitly for the specified locale.
public  booleangetLocalizedLookup()
     Returns if localized template lookup is enabled or not.
public  TemplateModelgetSharedVariable(String name)
     Gets a shared variable.
public  SetgetSharedVariableNames()
     Returns the set containing the names of all defined shared variables. The method returns a new Set object on each call that is completely disconnected from the Configuration.
public  booleangetStrictSyntaxMode()
     Tells whether directives such as if, else, etcetera must be written as #if, #else, etcetera.
public  intgetTagSyntax()
    
public  TemplategetTemplate(String name)
     Equivalent to getTemplate(name, thisCfg.getLocale(), thisCfg.getEncoding(thisCfg.getLocale()), true).
public  TemplategetTemplate(String name, Locale locale)
     Equivalent to getTemplate(name, locale, thisCfg.getEncoding(locale), true).
public  TemplategetTemplate(String name, String encoding)
     Equivalent to getTemplate(name, thisCfg.getLocale(), encoding, true).
public  TemplategetTemplate(String name, Locale locale, String encoding)
     Equivalent to getTemplate(name, locale, encoding, true).
public  TemplategetTemplate(String name, Locale locale, String encoding, boolean parse)
     Retrieves a template specified by a name and locale, interpreted using the specified character encoding, either parsed or unparsed.
public  TemplateLoadergetTemplateLoader()
    
public static  StringgetVersionNumber()
     Returns FreeMarker version number string.
public  booleangetWhitespaceStripping()
     Gets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.
public  voidloadBuiltInEncodingMap()
     Loads a preset language-to-encoding map.
public synchronized  voidremoveAutoImport(String namespace)
    
public synchronized  voidremoveAutoInclude(String templateName)
     remove a template from the auto-include list.
public  voidsetAllSharedVariables(TemplateHashModelEx hash)
     Adds all object in the hash as shared variable to the configuration.
public synchronized  voidsetAutoImports(Map map)
     set a map of namespace names to templates for auto-importing a set of templates.
public synchronized  voidsetAutoIncludes(List templateNames)
     set the list of automatically included templates.
public synchronized  voidsetCacheStorage(CacheStorage storage)
    
public  voidsetClassForTemplateLoading(Class clazz, String pathPrefix)
     Sets a class relative to which we do the Class.getResource() call to load templates.
public static  voidsetDefaultConfiguration(Configuration config)
     Sets the Configuration object that will be retrieved from future calls to Configuration.getDefaultConfiguration() .
public  voidsetDefaultEncoding(String encoding)
     Sets the default encoding for converting bytes to characters when reading template files in a locale for which no explicit encoding was specified.
public  voidsetDirectoryForTemplateLoading(File dir)
     Set the explicit directory from which to load templates.
public  voidsetEncoding(Locale locale, String encoding)
     Sets the character set encoding to use for templates of a given locale.
public  voidsetLocalizedLookup(boolean localizedLookup)
     Enables/disables localized template lookup.
public  voidsetServletContextForTemplateLoading(Object sctxt, String path)
     Sets the servlet context from which to load templates
Parameters:
  sctxt - the ServletContext object.
public  voidsetSetting(String key, String value)
     Sets a setting by name and string value. In additional to the settings understood by Configurable.setSetting the super method , it understands these:
  • "auto_import": Sets the list of auto-imports.
public  voidsetSharedVariable(String name, TemplateModel tm)
     Adds a shared variable to the configuration.
public  voidsetSharedVariable(String name, Object obj)
     Adds shared variable to the configuration.
public  voidsetStrictSyntaxMode(boolean b)
     Sets whether directives such as if, else, etcetera must be written as #if, #else, etcetera. Any tag not starting with <# or </# is considered as plain text and will go to the output as is.
public  voidsetTagSyntax(int tagSyntax)
     Determines the syntax of the template files (angle bracket VS square bracket) that has no ftl directive in it.
public synchronized  voidsetTemplateLoader(TemplateLoader loader)
     Sets a template loader that is used to look up and load templates. By providing your own template loader, you can customize the way templates are loaded.
public  voidsetTemplateUpdateDelay(int delay)
     Set the time in seconds that must elapse before checking whether there is a newer version of a template file.
public  voidsetWhitespaceStripping(boolean b)
     Sets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.

Field Detail
ANGLE_BRACKET_TAG_SYNTAX
final public static int ANGLE_BRACKET_TAG_SYNTAX(Code)



AUTO_DETECT_TAG_SYNTAX
final public static int AUTO_DETECT_TAG_SYNTAX(Code)



AUTO_IMPORT_KEY
final public static String AUTO_IMPORT_KEY(Code)



AUTO_INCLUDE_KEY
final public static String AUTO_INCLUDE_KEY(Code)



CACHE_STORAGE_KEY
final public static String CACHE_STORAGE_KEY(Code)



DEFAULT_ENCODING_KEY
final public static String DEFAULT_ENCODING_KEY(Code)



LOCALIZED_LOOKUP_KEY
final public static String LOCALIZED_LOOKUP_KEY(Code)



SQUARE_BRACKET_TAG_SYNTAX
final public static int SQUARE_BRACKET_TAG_SYNTAX(Code)



STRICT_SYNTAX_KEY
final public static String STRICT_SYNTAX_KEY(Code)



TAG_SYNTAX_KEY
final public static String TAG_SYNTAX_KEY(Code)



TEMPLATE_UPDATE_DELAY_KEY
final public static String TEMPLATE_UPDATE_DELAY_KEY(Code)



WHITESPACE_STRIPPING_KEY
final public static String WHITESPACE_STRIPPING_KEY(Code)




Constructor Detail
Configuration
public Configuration()(Code)




Method Detail
addAutoImport
public synchronized void addAutoImport(String namespace, String template)(Code)
Add an auto-imported template. The importing will happen at the top of any template that is vended by this Configuration object.
Parameters:
  namespace - the name of the namespace into which the template is imported
Parameters:
  template - the name of the template



addAutoInclude
public synchronized void addAutoInclude(String templateName)(Code)
add a template to be automatically included at the top of any template that is vended by this Configuration object.
Parameters:
  templateName - the lookup name of the template.



clearEncodingMap
public void clearEncodingMap()(Code)
Clears language-to-encoding map.
See Also:   Configuration.loadBuiltInEncodingMap
See Also:   Configuration.setEncoding



clearSharedVariables
public void clearSharedVariables()(Code)
Removes all shared variables, except the predefined ones (compress, html_escape, etc.).



clearTemplateCache
public void clearTemplateCache()(Code)
Removes all entries from the template cache, thus forcing reloading of templates on subsequent getTemplate calls. This method is thread-safe and can be called while the engine works.



clone
public Object clone()(Code)



doAutoImports
void doAutoImports(Environment env) throws TemplateException, IOException(Code)



doAutoIncludes
void doAutoIncludes(Environment env) throws TemplateException, IOException(Code)



getDefaultConfiguration
public static Configuration getDefaultConfiguration()(Code)
Returns the default (singleton) Configuration object. Note that you can create as many separate configurations as you wish; this global instance is provided for convenience, or when you have no reason to use a separate instance. ConfigurationConfigurationConfiguration



getDefaultEncoding
public String getDefaultEncoding()(Code)
Gets the default encoding for converting bytes to characters when reading template files in a locale for which no explicit encoding was specified. Defaults to default system encoding.



getEncoding
public String getEncoding(Locale loc)(Code)
Gets the preferred character encoding for the given locale, or the default encoding if no encoding is set explicitly for the specified locale. You can associate encodings with locales using Configuration.setEncoding(Locale,String) or Configuration.loadBuiltInEncodingMap() .
Parameters:
  loc - the locale the preferred character encoding for the locale.



getLocalizedLookup
public boolean getLocalizedLookup()(Code)
Returns if localized template lookup is enabled or not. This method is thread-safe and can be called while the engine works.



getSharedVariable
public TemplateModel getSharedVariable(String name)(Code)
Gets a shared variable. Shared variables are variables that are available to all templates. When a template is processed, and an identifier is undefined in the data model, a shared variable object with the same identifier is then looked up in the configuration. There are several predefined variables that are always available through this method, see the FreeMarker manual for a comprehensive list of them.
See Also:   Configuration.setSharedVariable(String,Object)
See Also:   Configuration.setSharedVariable(String,TemplateModel)
See Also:   Configuration.setAllSharedVariables



getSharedVariableNames
public Set getSharedVariableNames()(Code)
Returns the set containing the names of all defined shared variables. The method returns a new Set object on each call that is completely disconnected from the Configuration. That is, modifying the set will have no effect on the Configuration object.



getStrictSyntaxMode
public boolean getStrictSyntaxMode()(Code)
Tells whether directives such as if, else, etcetera must be written as #if, #else, etcetera.
See Also:   Configuration.setStrictSyntaxMode



getTagSyntax
public int getTagSyntax()(Code)
whether the alternative square bracketsyntax is set as the default



getTemplate
public Template getTemplate(String name) throws IOException(Code)
Equivalent to getTemplate(name, thisCfg.getLocale(), thisCfg.getEncoding(thisCfg.getLocale()), true).



getTemplate
public Template getTemplate(String name, Locale locale) throws IOException(Code)
Equivalent to getTemplate(name, locale, thisCfg.getEncoding(locale), true).



getTemplate
public Template getTemplate(String name, String encoding) throws IOException(Code)
Equivalent to getTemplate(name, thisCfg.getLocale(), encoding, true).



getTemplate
public Template getTemplate(String name, Locale locale, String encoding) throws IOException(Code)
Equivalent to getTemplate(name, locale, encoding, true).



getTemplate
public Template getTemplate(String name, Locale locale, String encoding, boolean parse) throws IOException(Code)
Retrieves a template specified by a name and locale, interpreted using the specified character encoding, either parsed or unparsed. For the exact semantics of parameters, see TemplateCache.getTemplate(StringLocaleStringboolean) . the requested template.
throws:
  FileNotFoundException - if the template could not be found.
throws:
  IOException - if there was a problem loading the template.
throws:
  ParseException - (extends IOException) if the template is syntactically bad.



getTemplateLoader
public TemplateLoader getTemplateLoader()(Code)
the template loader that is used to look up and load templates.
See Also:   Configuration.setTemplateLoader



getVersionNumber
public static String getVersionNumber()(Code)
Returns FreeMarker version number string. Examples of possible return values: "2.2.5", "2.3pre13", "2.3pre13mod", "2.3rc1", "2.3", "3.0".

Notes on FreeMarker version numbering rules:

  • "pre" and "rc" (lowercase!) means "preview" and "release candidate" respectively. It is must be followed with a number (as "1" for the first release candidate).
  • The "mod" after the version number indicates that it's an unreleased modified version of the released version. After releases, the nighly builds are such releases. E.g. the nightly build after releasing "2.2.1" but before releasing "2.2.2" is "2.2.1mod".
  • The 2nd version number must be present, and maybe 0, as in "3.0".
  • The 3rd version number is never 0. E.g. the version number string for the first release of the 2.2 series is "2.2", and NOT "2.2.0".
  • When only the 3rd version number increases (2.2 -> 2.2.1, 2.2.1 -> 2.2.2 etc.), 100% backward compatiblity with the previous version MUST be kept. This means that freemarker.jar can be replaced in an application without risk (as far as the application doesn't depend on the presence of a FreeMarker bug). Note that backward compatibility restrictions do not apply for preview releases.



getWhitespaceStripping
public boolean getWhitespaceStripping()(Code)
Gets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.
See Also:   Configuration.setWhitespaceStripping



loadBuiltInEncodingMap
public void loadBuiltInEncodingMap()(Code)
Loads a preset language-to-encoding map. It assumes the usual character encodings for most languages. The previous content of the encoding map will be lost. This default map currently contains the following mappings:
arISO-8859-6
beISO-8859-5
bgISO-8859-5
caISO-8859-1
csISO-8859-2
daISO-8859-1
deISO-8859-1
elISO-8859-7
enISO-8859-1
esISO-8859-1
etISO-8859-1
fiISO-8859-1
frISO-8859-1
hrISO-8859-2
huISO-8859-2
isISO-8859-1
itISO-8859-1
iwISO-8859-8
jaShift_JIS
koEUC-KR
ltISO-8859-2
lvISO-8859-2
mkISO-8859-5
nlISO-8859-1
noISO-8859-1
plISO-8859-2
ptISO-8859-1
roISO-8859-2
ruISO-8859-5
shISO-8859-5
skISO-8859-2
slISO-8859-2
sqISO-8859-2
srISO-8859-5
svISO-8859-1
trISO-8859-9
ukISO-8859-5
zhGB2312
zh_TWBig5

See Also:   Configuration.clearEncodingMap
See Also:   Configuration.setEncoding



removeAutoImport
public synchronized void removeAutoImport(String namespace)(Code)
Remove an auto-imported template
Parameters:
  namespace - the name of the namespace into which the template was imported



removeAutoInclude
public synchronized void removeAutoInclude(String templateName)(Code)
remove a template from the auto-include list.
Parameters:
  templateName - the lookup name of the template in question.



setAllSharedVariables
public void setAllSharedVariables(TemplateHashModelEx hash) throws TemplateModelException(Code)
Adds all object in the hash as shared variable to the configuration.

Never use TemplateModel implementation that is not thread-safe for shared variables, if the configuration is used by multiple threads! It is the typical situation for Servlet based Web sites.
Parameters:
  hash - a hash model whose objects will be copied to theconfiguration with same names as they are given in the hash.If a shared variable with these names already exist, it will be replacedwith those from the map.
See Also:   Configuration.setSharedVariable(String,Object)
See Also:   Configuration.setSharedVariable(String,TemplateModel)




setAutoImports
public synchronized void setAutoImports(Map map)(Code)
set a map of namespace names to templates for auto-importing a set of templates. Note that all previous auto-imports are removed.



setAutoIncludes
public synchronized void setAutoIncludes(List templateNames)(Code)
set the list of automatically included templates. Note that all previous auto-includes are removed.



setCacheStorage
public synchronized void setCacheStorage(CacheStorage storage)(Code)



setClassForTemplateLoading
public void setClassForTemplateLoading(Class clazz, String pathPrefix)(Code)
Sets a class relative to which we do the Class.getResource() call to load templates.



setDefaultConfiguration
public static void setDefaultConfiguration(Configuration config)(Code)
Sets the Configuration object that will be retrieved from future calls to Configuration.getDefaultConfiguration() . ConfigurationConfiguration.getDefaultConfiguration here...



setDefaultEncoding
public void setDefaultEncoding(String encoding)(Code)
Sets the default encoding for converting bytes to characters when reading template files in a locale for which no explicit encoding was specified. Defaults to default system encoding.



setDirectoryForTemplateLoading
public void setDirectoryForTemplateLoading(File dir) throws IOException(Code)
Set the explicit directory from which to load templates.



setEncoding
public void setEncoding(Locale locale, String encoding)(Code)
Sets the character set encoding to use for templates of a given locale. If there is no explicit encoding set for some locale, then the default encoding will be used, what you can set with Configuration.setDefaultEncoding .
See Also:   Configuration.clearEncodingMap
See Also:   Configuration.loadBuiltInEncodingMap



setLocalizedLookup
public void setLocalizedLookup(boolean localizedLookup)(Code)
Enables/disables localized template lookup. Enabled by default. This method is thread-safe and can be called while the engine works.



setServletContextForTemplateLoading
public void setServletContextForTemplateLoading(Object sctxt, String path)(Code)
Sets the servlet context from which to load templates
Parameters:
  sctxt - the ServletContext object. Note that the type is Objectto prevent class loading errors when user who uses FreeMarker not forservlets has no javax.servlet in the CLASSPATH.
Parameters:
  path - the path relative to the ServletContext.If this path is absolute, it is taken to be relativeto the server's URL, i.e. http://myserver.com/and if the path is relative, it is taken to be relative to the web app context, i.e.http://myserver.context.com/mywebappcontext/



setSetting
public void setSetting(String key, String value) throws TemplateException(Code)
Sets a setting by name and string value. In additional to the settings understood by Configurable.setSetting the super method , it understands these:
  • "auto_import": Sets the list of auto-imports. Example of valid value:
    /lib/form.ftl as f, /lib/widget as w, "/lib/evil name.ftl" as odd See: Configuration.setAutoImports
  • "auto_include": Sets the list of auto-includes. Example of valid value:
    /include/common.ftl, "/include/evil name.ftl" See: Configuration.setAutoIncludes
  • "default_encoding": The name of the charset, such as "UTF-8". See: Configuration.setDefaultEncoding
  • "localized_lookup": "true", "false", "yes", "no", "t", "f", "y", "n". Case insensitive. See: Configuration.setLocalizedLookup
  • "strict_syntax": "true", "false", etc. See: Configuration.setStrictSyntaxMode
  • "whitespace_stripping": "true", "false", etc. See: Configuration.setWhitespaceStripping
  • "cache_storage": If the value contains dot, then it is interpreted as class name, and the object will be created with its parameterless constructor. If the value does not contain dot, then a freemarker.cache.MruCacheStorage will be used with the maximum strong and soft sizes specified with the setting value. Examples of valid setting values:
    Setting valuemax. strong sizemax. soft size
    "strong:50, soft:500"50500
    "strong:100, soft"100Integer.MAX_VALUE
    "strong:100"1000
    "soft:100"0100
    "strong"Integer.MAX_VALUE0
    "soft"0Integer.MAX_VALUE
    The value is not case sensitive. The order of soft and strong entries is not significant. See also: Configuration.setCacheStorage
  • "template_update_delay": Valid positive integer, the update delay measured in seconds. See: Configuration.setTemplateUpdateDelay
  • "tag_syntax": Must be one of: "auto_detect", "angle_bracket", "square_bracket".

Parameters:
  key - the name of the setting.
Parameters:
  value - the string that describes the new value of the setting.
throws:
  UnknownSettingException - if the key is wrong.
throws:
  TemplateException - if the new value of the setting can't be setfor any other reasons.



setSharedVariable
public void setSharedVariable(String name, TemplateModel tm)(Code)
Adds a shared variable to the configuration. Shared variables are variables that are visible as top-level variables for all templates which use this configuration, if the data model does not contain a variable with the same name.

Never use TemplateModel implementation that is not thread-safe for shared variables, if the configuration is used by multiple threads! It is the typical situation for Servlet based Web sites.
Parameters:
  name - the name used to access the data object from your template.If a shared variable with this name already exists, it will replacethat.
See Also:   Configuration.setSharedVariable(String,Object)
See Also:   Configuration.setAllSharedVariables




setSharedVariable
public void setSharedVariable(String name, Object obj) throws TemplateModelException(Code)
Adds shared variable to the configuration. It uses Configurable.getObjectWrapper to wrap the obj.
See Also:   Configuration.setSharedVariable(String,TemplateModel)
See Also:   Configuration.setAllSharedVariables



setStrictSyntaxMode
public void setStrictSyntaxMode(boolean b)(Code)
Sets whether directives such as if, else, etcetera must be written as #if, #else, etcetera. Any tag not starting with <# or </# is considered as plain text and will go to the output as is. Tag starting with <# or </# must be valid FTL tag, or else the template is invalid (i.e. <#noSuchDirective> is an error).



setTagSyntax
public void setTagSyntax(int tagSyntax)(Code)
Determines the syntax of the template files (angle bracket VS square bracket) that has no ftl directive in it. The tagSyntax parameter must be one of:

In FreeMarker 2.3.x Configuration.ANGLE_BRACKET_TAG_SYNTAX is the default for better backward compatibility. Starting from 2.4.x Configuration.AUTO_DETECT_TAG_SYNTAX is the default, so it is recommended to use that even for 2.3.x.

This setting is ignored for the templates that have ftl directive in it. For those templates the syntax used for the ftl directive determines the syntax.




setTemplateLoader
public synchronized void setTemplateLoader(TemplateLoader loader)(Code)
Sets a template loader that is used to look up and load templates. By providing your own template loader, you can customize the way templates are loaded. Several convenience methods in this class already allow you to install commonly used loaders: Configuration.setClassForTemplateLoading(Class,String) , Configuration.setDirectoryForTemplateLoading(File) , and Configuration.setServletContextForTemplateLoading(Object,String) . By default, a multi-loader is used that first tries to load a template from the file in the current directory, then from a resource on the classpath.



setTemplateUpdateDelay
public void setTemplateUpdateDelay(int delay)(Code)
Set the time in seconds that must elapse before checking whether there is a newer version of a template file. This method is thread-safe and can be called while the engine works.



setWhitespaceStripping
public void setWhitespaceStripping(boolean b)(Code)
Sets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.



Fields inherited from freemarker.core.Configurable
final public static String ARITHMETIC_ENGINE_KEY(Code)(Java Doc)
final public static String BOOLEAN_FORMAT_KEY(Code)(Java Doc)
final public static String CLASSIC_COMPATIBLE_KEY(Code)(Java Doc)
final public static String DATETIME_FORMAT_KEY(Code)(Java Doc)
final public static String DATE_FORMAT_KEY(Code)(Java Doc)
final public static String LOCALE_KEY(Code)(Java Doc)
final public static String NUMBER_FORMAT_KEY(Code)(Java Doc)
final public static String OBJECT_WRAPPER_KEY(Code)(Java Doc)
final public static String OUTPUT_ENCODING_KEY(Code)(Java Doc)
final public static String STRICT_BEAN_MODELS(Code)(Java Doc)
final public static String TEMPLATE_EXCEPTION_HANDLER_KEY(Code)(Java Doc)
final public static String TIME_FORMAT_KEY(Code)(Java Doc)
final public static String TIME_ZONE_KEY(Code)(Java Doc)
final public static String URL_ESCAPING_CHARSET_KEY(Code)(Java Doc)

Methods inherited from freemarker.core.Configurable
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public ArithmeticEngine getArithmeticEngine()(Code)(Java Doc)
public String getBooleanFormat()(Code)(Java Doc)
public Object getCustomAttribute(String name)(Code)(Java Doc)
public String[] getCustomAttributeNames()(Code)(Java Doc)
public String getDateFormat()(Code)(Java Doc)
public String getDateTimeFormat()(Code)(Java Doc)
protected Environment getEnvironment()(Code)(Java Doc)
public Locale getLocale()(Code)(Java Doc)
public String getNumberFormat()(Code)(Java Doc)
public ObjectWrapper getObjectWrapper()(Code)(Java Doc)
public String getOutputEncoding()(Code)(Java Doc)
final public Configurable getParent()(Code)(Java Doc)
public String getSetting(String key)(Code)(Java Doc)
public Map getSettings()(Code)(Java Doc)
public TemplateExceptionHandler getTemplateExceptionHandler()(Code)(Java Doc)
public String getTimeFormat()(Code)(Java Doc)
public TimeZone getTimeZone()(Code)(Java Doc)
public String getURLEscapingCharset()(Code)(Java Doc)
protected TemplateException invalidSettingValueException(String name, String value)(Code)(Java Doc)
public boolean isClassicCompatible()(Code)(Java Doc)
public void removeCustomAttribute(String name)(Code)(Java Doc)
public void setArithmeticEngine(ArithmeticEngine arithmeticEngine)(Code)(Java Doc)
public void setBooleanFormat(String booleanFormat)(Code)(Java Doc)
public void setClassicCompatible(boolean classicCompatibility)(Code)(Java Doc)
public void setCustomAttribute(String name, Object value)(Code)(Java Doc)
public void setDateFormat(String dateFormat)(Code)(Java Doc)
public void setDateTimeFormat(String dateTimeFormat)(Code)(Java Doc)
public void setLocale(Locale locale)(Code)(Java Doc)
public void setNumberFormat(String numberFormat)(Code)(Java Doc)
public void setObjectWrapper(ObjectWrapper objectWrapper)(Code)(Java Doc)
public void setOutputEncoding(String outputEncoding)(Code)(Java Doc)
public void setSetting(String key, String value) throws TemplateException(Code)(Java Doc)
public void setSettings(Properties props) throws TemplateException(Code)(Java Doc)
public void setSettings(InputStream propsIn) throws TemplateException, IOException(Code)(Java Doc)
public void setStrictBeanModels(boolean strict)(Code)(Java Doc)
public void setTemplateExceptionHandler(TemplateExceptionHandler templateExceptionHandler)(Code)(Java Doc)
public void setTimeFormat(String timeFormat)(Code)(Java Doc)
public void setTimeZone(TimeZone timeZone)(Code)(Java Doc)
public void setURLEscapingCharset(String urlEscapingCharset)(Code)(Java Doc)
protected TemplateException unknownSettingException(String name)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.