org.ogf.graap.wsag.server.actions.impl
Class FileTemplate

java.lang.Object
  extended by org.ogf.graap.wsag.server.actions.impl.FileTemplate

public class FileTemplate
extends Object

Default implementation to load files from the classpath an process these files as Velocity templates. Additional parameters can be specified, which can be used in the Velocity macros defined in the file.

Author:
owaeld

Field Summary
static String VELOCITY_PROPERTIES_FILE
          Velocity properties filename.
static String VELOCITY_PROPERTIES_FILE_DEFAULT
          Default velocity properties filename.
 
Constructor Summary
FileTemplate(String filename)
          Creates a new file template for the given file name.
 
Method Summary
 void addParameter(String key, Object value)
          Adds a new parameter to the Velocity context.
 void processTemplate(OutputStream out)
          Processes the file template as Velocity template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VELOCITY_PROPERTIES_FILE

public static final String VELOCITY_PROPERTIES_FILE
Velocity properties filename. Applications may provide a custom properties file in order to overwrite default configuration. If this file does not exist in the classpath the default velocity configuration is used.

See Also:
Constant Field Values

VELOCITY_PROPERTIES_FILE_DEFAULT

public static final String VELOCITY_PROPERTIES_FILE_DEFAULT
Default velocity properties filename.

See Also:
Constant Field Values
Constructor Detail

FileTemplate

public FileTemplate(String filename)
Creates a new file template for the given file name. The file with the specified name is resolved from the classpath.

Parameters:
filename - the file name
Method Detail

addParameter

public void addParameter(String key,
                         Object value)
Adds a new parameter to the Velocity context. Parameters can be accessed in the template by its key.

Parameters:
key - the parameter name
value - the parameter value

processTemplate

public void processTemplate(OutputStream out)
Processes the file template as Velocity template.

Parameters:
out - the OutputStream where the result is written to


Copyright © 2008-2012. All Rights Reserved.