Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

freemarker.cache.* (13)freemarker.core.* (90)freemarker.debug.* (13)freemarker.examples.* (1)
freemarker.ext.* (75)freemarker.log.* (6)freemarker.template.* (57)freemarker.testcase.* (26)

Package Samples:

freemarker.template.utility: This package contains the core API's that most users will use.  
freemarker.examples.jsp
freemarker.cache
freemarker.core
freemarker.debug.impl
freemarker.debug
freemarker.ext.ant
freemarker.ext.beans
freemarker.ext.dom
freemarker.ext.jdom
freemarker.ext.jsp
freemarker.ext.jython
freemarker.ext.rhino
freemarker.ext.servlet
freemarker.ext.util
freemarker.ext.xml
freemarker.log
freemarker.template
freemarker.testcase.models
freemarker.testcase.servlets

Classes:

FreemarkerXmlTask: This is an Ant task for transforming XML documents using FreeMarker templates. It uses the adapter class freemarker.ext.xml.NodeListModel . It will read a set of XML documents, and pass them to the template for processing, building the corresponding output files in the destination directory. It makes the following variables available to the template in the data model: document : Deprecated! The DOM tree of the currently processed XML file wrapped with the legacy freemarker.ext.xml.NodeListModel . For new projects you should use the .node instead, which initially contains the DOM Document wrapped ...
FreemarkerServlet: This is a general-purpose FreeMarker view servlet. The main features are: It makes all request, request parameters, session, and servlet context attributes available to templates through Request , RequestParameters , Session , and Application variables. The scope variables are also available via automatic scope discovery. That is, writing Application.attrName , Session.attrName , Request.attrName is not mandatory; it's enough to write attrName , and if no such variable was created in the template, it will search the variable in Request , and then in Session , and finally in Application . It creates ...
NodeListModel: Provides a template for wrapping JDOM objects. It is capable of storing not only a single JDOM node, but a list of JDOM nodes at once (hence the name). Each node is an instance of any of the core JDOM node classes (except namespaces, which are not supported at the moment), or String for representing text. See individual method documentation for exact details on how the class works. In short: getAsString() 55 will render all contained nodes as XML fragment, exec(List) 55 provides full XPath functionality implemented on top of the Jaxen library, get(String) 55 provides node traversal, copying and ...
StringTemplateLoader: A TemplateLoader that uses a Map with Strings as its source of templates. In most case the regular way of loading templates from files will be fine. However, there can be situations where you don't want to or can't load a template from a file, e.g. if you have to deploy a single jar for JavaWebStart or if they are contained within a database. A single template can be created manually e.g. String templateStr="Hello ${user}"; Template t = new Template("name", new StringReader(templateStr), new Configuration()); If, however, you want to create templates from strings which import other templates this ...
Template: A core FreeMarker API that represents a compiled template. Typically, you will use a Configuration object to instantiate a template. Configuration cfg = new Configuration(); ... Template myTemplate = cfg.getTemplate("myTemplate.html"); However, you can also construct a template directly by passing in to the appropriate constructor a java.io.Reader instance that is set to read the raw template text. The compiled template is stored in an an efficient data structure for later use. To render the template, i.e. to merge it with a data model, and thus produce "cooked" output, call the process method. ...
NodeListModel: A data model adapter for three widespread XML document object model representations: W3C DOM, dom4j, and JDOM. The adapter automatically recognizes the used XML object model and provides a unified interface for it toward the template. The model provides access to all XML InfoSet features of the XML document and includes XPath support if it has access to the XPath- evaluator library Jaxen. The model's philosophy (which closely follows that of XML InfoSet and XPath) is as follows: it always wraps a list of XML nodes (the "nodelist"). The list can be empty, can have a single element, or can have multiple ...
TemplateTransformModel: Objects that implement this interface can be used in a <transform> block to perform arbitrary transformations on a part of the template processing output. Note that, as of FreeMarker 2.1, TemplateTransform Model has changed. This is a more powerful implementation. There is a quick-and-dirty way to patch any legacy TemplateTransformModel so that it implements the new API. You simply add the following as your implementation of the getWriter() call: public Writer getWriter(final Writer out, Map args) { final StringBuffer buf = new StringBuffer(); return new Writer() { public void write(char cbuf[], ...
MruCacheStorage: A cache storage that implements a two-level Most Recently Used cache. In the first level, items are strongly referenced up to the specified maximum. 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. When the second level maximum is also exceeded, the least recently used item is discarded altogether. This cache storage is a generalization of both StrongCacheStorage and SoftCacheStorage - the effect of both of them can be achieved by setting one maximum to zero and the other to the largest ...
MapModel: A special case of BeanModel that adds implementation for freemarker.template.TemplateMethodModelEx on map objects that is a shortcut for the Map.get() method. Note that if the passed argument itself is a reflection-wrapper model, then the map lookup will be performed using the wrapped object as the key. Note that you can call get() using the map.key syntax inherited from BeanModel as well, however in that case the key is always a string. The class itself does not implement the freemarker.template.TemplateCollectionModel . You can, however use map.entrySet() , map.keySet() , or map.values() to obtain ...
SimpleCollection: A simple implementation of TemplateCollectionModel . It's able to wrap java.util.Iterator -s and java.util.Collection -s. If you wrap an Iterator , the variable can be <list>-ed (<forach>-ed) only once! Consider using SimpleSequence instead of this class if you want to wrap Iterator s. SimpleSequence will read all elements of the Iterator , and store them in a List (this may cause too high resource consumption in some applications), so you can list the variable for unlimited times. Also, if you want to wrap Collection s, and then list the resulting variable for many times, SimpleSequence ...
Environment: Object that represents the runtime environment during template processing. For every invocation of a Template.process() method, a new instance of this object is created, and then discarded when process() returns. This object stores the set of temporary variables created by the template, the value of settings set by the template, the reference to the data model root, etc. Everything that is needed to fulfill the template processing job. Data models that need to access the Environment object that represents the template processing on the current thread can use the getCurrentEnvironment() 55 method. ...
TemplateHashModelEx: An extended hash interface with a couple of extra hooks. If a class implements this interface, then the built-in operators ?size , ?keys , and ?values can be applied to its instances in the template. As of version 2.2.2, the engine will automatically wrap the collections returned by keys and values to present them as sequences to the template. For performance, you may wish to return objects that implement both TemplateCollectionModel and TemplateSequenceModel . Note that the wrapping to sequence happens on demand; if the template does not try to use the variable returned by ?keys or ?values as ...
StandardCompress: A filter that compresses each sequence of consecutive whitespace to a single line break (if the sequence contains a line break) or a single space. In addition, leading and trailing whitespace is completely removed. Specify the transform parameter single_line = true to always compress to a single space instead of a line break. The default buffer size can be overridden by specifying a buffer_size transform parameter (in bytes). Note: The compress tag is implemented using this filter Usage: From java: SimpleHash root = new SimpleHash(); root.put( "standardCompress", new freemarker.template.utility.StandardCompress() ...
CaptureOutput: A transform that captures the output of a block of FTL code and stores that in a variable. As this transform is initially present in the shared variable set, you can always access it from the templates: <@capture_output var="captured"> ... </@capture_output> And later in the template you can use the captured output: ${captured} This transform requires one of three parameters: var , local , or global . Each of them specifies the name of the variable that stores the captured output, but the first creates a variable in a name-space (as <#assign>), the second creates a macro-local variable ...
IteratorModel: A class that adds freemarker.template.TemplateModelIterator functionality to the java.util.Iterator interface implementers. It differs from the freemarker.template.SimpleCollection in that it inherits from BeanModel , and therefore you can call methods on it directly, even to the effect of calling iterator.remove() in the template. Using the model as a collection model is NOT thread-safe, as iterators are inherently not thread-safe. Further, you can iterate over it only once. Attempts to call the iterator() 55 method after it was already driven to the end once will throw an exception.
SimpleSequence: A convenient implementation of a list. This object implements TemplateSequenceModel , using an underlying java.util.List implementation. A SimpleSequence can act as a cache for a TemplateCollectionModel , e.g. one that gets data from a database. When passed a TemplateCollectionModel as an argument to its constructor, the SimpleSequence immediately copies all the elements and discards the TemplateCollectionModel . This class is thread-safe if you don't call the add method after you have made the object available for multiple threads. Note: As of 2.0, this class is unsynchronized by default. To obtain ...
DebuggedEnvironment: Represents the debugger-side mirror of a debugged freemarker.core.Environment object in the remote VM. This interface extends DebugModel , and the properties of the Environment are exposed as hash keys on it. Specifically, the following keys are supported: "currentNamespace", "dataModel", "globalNamespace", "knownVariables", "mainNamespace", and "template". The debug model for the template supports keys "configuration" and "name". The debug model for the configuration supports key "sharedVariables". Additionally, all of the debug models for environment, template, and configuration also support ...
JythonHashModel: Model for Jython dictionaries ( org.python.core.PyDictionary and org.python.core.PyStringMap ). Note that the basic JythonModel already provides access to the PyObject#__finditem__(String) method. This class only adds freemarker.template.TemplateHashModelEx functionality in a somewhat skewed way. One could say it even violates TemplateHashModelEx semantics, as both the returned keys and values are only those from the item mapping, while the get() method works for attributes as well. However, in practice when you ask for dict?keys inside a template, you'll really want to retrieve only items, not ...
Configurable: This is a common superclass of freemarker.template.Configuration , freemarker.template.Template , and Environment classes. It provides settings that are common to each of them. FreeMarker uses a three-level setting hierarchy - the return value of every setting getter method on Configurable objects inherits its value from its parent Configurable object, unless explicitly overridden by a call to a corresponding setter method on the object itself. The parent of an Environment object is a Template object, the parent of a Template object is a Configuration object.
Configuration: 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 setTemplateLoader(TemplateLoader) 55 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 ...
DebugModel: Represents the debugger-side mirror of a TemplateModel object, a Template object, or a Configuration object. The Environment objects are also represented by instances of this model, although not directly but through a separate subinterface DebuggedEnvironment . The interface is a union of almost all of FreeMarker template models with identical method signatures. For purposes of optimizing network traffic there are bulk retrieval methods for sequences and hashes, as well as a getModelTypes() 55 method that returns a bit mask of various TYPE_xxx constants flagging which template models are implemented ...
MultiTemplateLoader: A TemplateLoader that uses a set of other loaders to load the templates. On every request, loaders are queried in the order of their appearance in the array of loaders that this Loader owns. If a request for some template name was already satisfied in the past by one of the loaders, that Loader is queried first (a soft affinity). This class is NOT thread-safe. If it is accessed from multiple threads concurrently, proper synchronization must be provided by the callers. Note that TemplateCache , the natural user of this class provides the necessary synchronizations when it uses the class.
NormalizeNewlines: Transformer that supports FreeMarker legacy behavior: all newlines appearing within the transformed area will be transformed into the platform's default newline. Unlike the old behavior, however, newlines generated by the data model are also converted. Legacy behavior was to leave newlines in the data model unaltered. Usage: From java: SimpleHash root = new SimpleHash(); root.put( "normalizeNewlines", new freemarker.template.utility.NormalizeNewlines() ); ... From your FreeMarker template: <transform normalizeNewlines> <html> <head> ... <p>This template has all newlines ...
Execute: Gives FreeMarker the the ability to execute external commands. Will fork a process, and inline anything that process sends to stdout in the template. Based on a patch submitted by Peter Molettiere. BE CAREFUL! this tag, depending on use, may allow you to set something up so that users of your web application could run arbitrary code on your server. This can only happen if you allow unchecked GET/POST submissions to be used as the command string in the exec tag. Usage: From java: SimpleHash root = new SimpleHash(); root.put( "exec", new freemarker.template.utility.Execute() ); ... From your FreeMarker ...

Home | Contact Us | Privacy Policy | Terms of Service