public class Runtime extends java.lang.Object implements RuntimeConstants
Runtime.setProperty(Runtime.FILE_RESOURCE_LOADER_PATH, templatePath); Runtime.setProperty(Runtime.RUNTIME_LOG, pathToVelocityLog); Runtime.init();
----------------------------------------------------------------------- N O T E S O N R U N T I M E I N I T I A L I Z A T I O N ----------------------------------------------------------------------- Runtime.init() If Runtime.init() is called by itself the Runtime will initialize with a set of default values. ----------------------------------------------------------------------- Runtime.init(String/Properties) In this case the default velocity properties are layed down first to provide a solid base, then any properties provided in the given properties object will override the corresponding default property. -----------------------------------------------------------------------
RuntimeInstance,
RuntimeSingletonCOUNTER_INITIAL_VALUE, COUNTER_NAME, DEBUG_PREFIX, DEFAULT_RUNTIME_DIRECTIVES, DEFAULT_RUNTIME_PROPERTIES, DEFINE_DIRECTIVE_MAXDEPTH, DIRECTIVE_IF_TOSTRING_NULLCHECK, ENCODING_DEFAULT, ERROR_PREFIX, ERRORMSG_END, ERRORMSG_START, EVALUATE_CONTEXT_CLASS, EVENTHANDLER_INCLUDE, EVENTHANDLER_INVALIDREFERENCES, EVENTHANDLER_METHODEXCEPTION, EVENTHANDLER_NULLSET, EVENTHANDLER_REFERENCEINSERTION, FILE_RESOURCE_LOADER_CACHE, FILE_RESOURCE_LOADER_PATH, HAS_NEXT_NAME, INFO_PREFIX, INPUT_ENCODING, INTERPOLATE_STRINGLITERALS, INTROSPECTOR_RESTRICT_CLASSES, INTROSPECTOR_RESTRICT_PACKAGES, MAX_NUMBER_LOOPS, NUMBER_OF_PARSERS, OUTPUT_ENCODING, PARSE_DIRECTIVE_MAXDEPTH, PARSER_POOL_CLASS, PARSER_POOL_SIZE, PROVIDE_SCOPE_CONTROL, RESOURCE_LOADER, RESOURCE_MANAGER_CACHE_CLASS, RESOURCE_MANAGER_CLASS, RESOURCE_MANAGER_DEFAULTCACHE_SIZE, RESOURCE_MANAGER_LOGWHENFOUND, RUNTIME_LOG, RUNTIME_LOG_ERROR_STACKTRACE, RUNTIME_LOG_INFO_STACKTRACE, RUNTIME_LOG_LOGSYSTEM, RUNTIME_LOG_LOGSYSTEM_CLASS, RUNTIME_LOG_REFERENCE_LOG_INVALID, RUNTIME_LOG_WARN_STACKTRACE, RUNTIME_REFERENCES_STRICT, RUNTIME_REFERENCES_STRICT_ESCAPE, SET_NULL_ALLOWED, SKIP_INVALID_ITERATOR, STRICT_MATH, TRACE_PREFIX, UBERSPECT_CLASSNAME, UNKNOWN_PREFIX, VM_ARGUMENTS_STRICT, VM_BODY_REFERENCE, VM_CONTEXT_LOCALSCOPE, VM_LIBRARY, VM_LIBRARY_AUTORELOAD, VM_LIBRARY_DEFAULT, VM_MAX_DEPTH, VM_MESSAGES_ON, VM_PERM_ALLOW_INLINE, VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL, VM_PERM_INLINE_LOCAL, WARN_PREFIX| 构造器和说明 |
|---|
Runtime()
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addProperty(java.lang.String key,
java.lang.Object value)
已过时。
Add a property to the configuration.
|
static boolean |
addVelocimacro(java.lang.String name,
java.lang.String macro,
java.lang.String[] argArray,
java.lang.String sourceTemplate)
已过时。
Just like the whole class....
|
static void |
clearProperty(java.lang.String key)
已过时。
Clear the values pertaining to a particular
property.
|
static void |
debug(java.lang.Object message)
已过时。
Log a debug message.
|
static boolean |
dumpVMNamespace(java.lang.String namespace)
已过时。
tells the vmFactory to dump the specified namespace.
|
static void |
error(java.lang.Object message)
已过时。
Log an error message.
|
static boolean |
getBoolean(java.lang.String key,
boolean def)
已过时。
Boolean property accessor method to hide the configuration implementation.
|
static org.apache.commons.collections.ExtendedProperties |
getConfiguration()
已过时。
Return the velocity runtime configuration object.
|
static ContentResource |
getContent(java.lang.String name)
已过时。
Returns a static content resource from the
resource manager.
|
static ContentResource |
getContent(java.lang.String name,
java.lang.String encoding)
已过时。
Returns a static content resource from the
resource manager.
|
static int |
getInt(java.lang.String key)
已过时。
Int property accessor method to hide the configuration implementation.
|
static int |
getInt(java.lang.String key,
int defaultValue)
已过时。
Int property accessor method to hide the configuration implementation.
|
static java.lang.String |
getLoaderNameForResource(java.lang.String resourceName)
已过时。
Determines is a template exists, and returns name of the loader that
provides it.
|
static java.lang.Object |
getProperty(java.lang.String key)
已过时。
Allows an external caller to get a property.
|
static java.lang.String |
getString(java.lang.String key)
已过时。
String property accessor method to hide the configuration implementation
|
static java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
已过时。
String property accessor method with default to hide the
configuration implementation.
|
static Template |
getTemplate(java.lang.String name)
已过时。
Returns a
Template from the resource manager. |
static Template |
getTemplate(java.lang.String name,
java.lang.String encoding)
已过时。
Returns a
Template from the resource manager |
static Directive |
getVelocimacro(java.lang.String vmName,
java.lang.String templateName)
已过时。
Returns the appropriate VelocimacroProxy object if strVMname
is a valid current Velocimacro.
|
static void |
info(java.lang.Object message)
已过时。
Log an info message.
|
static void |
init()
已过时。
This is the primary initialization method in the Velocity
Runtime.
|
static void |
init(java.util.Properties p)
已过时。
Initialize the Velocity Runtime with a Properties
object.
|
static void |
init(java.lang.String configurationFile)
已过时。
Initialize the Velocity Runtime with the name of
ExtendedProperties object.
|
static boolean |
isVelocimacro(java.lang.String vmName,
java.lang.String templateName)
已过时。
Checks to see if a VM exists
|
static SimpleNode |
parse(java.io.Reader reader,
java.lang.String templateName)
已过时。
Parse the input and return the root of
AST node structure.
|
static SimpleNode |
parse(java.io.Reader reader,
java.lang.String templateName,
boolean dumpNamespace)
已过时。
Parse the input and return the root of the AST node structure.
|
static void |
setConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
已过时。
Allow an external system to set an ExtendedProperties
object to use.
|
static void |
setProperty(java.lang.String key,
java.lang.Object value)
已过时。
Allows an external system to set a property in
the Velocity Runtime.
|
static void |
warn(java.lang.Object message)
已过时。
Log a warning message.
|
public static void init()
throws java.lang.Exception
java.lang.Exception - When init fails for any reason.public static void setProperty(java.lang.String key,
java.lang.Object value)
key - The property key.value - The property value.public static void setConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
configuration - A configuration object.public static void addProperty(java.lang.String key,
java.lang.Object value)
key - A property key.value - The property value.public static void clearProperty(java.lang.String key)
key - Name of the property to clear.public static java.lang.Object getProperty(java.lang.String key)
key - property to returnpublic static void init(java.util.Properties p)
throws java.lang.Exception
p - The properties used for initializiation.java.lang.Exception - When a problem occurs during init.public static void init(java.lang.String configurationFile)
throws java.lang.Exception
configurationFile - The name of a properties file.java.lang.Exception - When a problem occurs during init.public static SimpleNode parse(java.io.Reader reader, java.lang.String templateName) throws ParseException
reader - A reader returning the template input stream.templateName - name of the template being parsedParseException - When the input stream is not parsable.public static SimpleNode parse(java.io.Reader reader, java.lang.String templateName, boolean dumpNamespace) throws ParseException
reader - A reader returning the template input stream.templateName - name of the template being parseddumpNamespace - flag to dump the Velocimacro namespace for this template.ParseException - When the input stream is not parsable.parse(Reader, String)public static Template getTemplate(java.lang.String name) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
Template from the resource manager.
This method assumes that the character encoding of the
template is set by the input.encoding
property. The default is "ISO-8859-1"name - The file name of the desired template.ResourceNotFoundException - if template not found
from any available source.ParseErrorException - if template cannot be parsed due
to syntax (or other) error.java.lang.Exception - if an error occurs in template initialization.public static Template getTemplate(java.lang.String name, java.lang.String encoding) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
Template from the resource managername - The name of the desired template.encoding - Character encoding of the templateResourceNotFoundException - if template not found
from any available source.ParseErrorException - if template cannot be parsed due
to syntax (or other) error.java.lang.Exception - if an error occurs in template initializationpublic static ContentResource getContent(java.lang.String name) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
name - Name of content resource to getResourceNotFoundException - if template not found
from any available source.ParseErrorException - if template cannot be parsed due
to syntax (or other) error.java.lang.Exception - if an error occurs in template initializationpublic static ContentResource getContent(java.lang.String name, java.lang.String encoding) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
name - Name of content resource to getencoding - Character encoding to useResourceNotFoundException - if template not found
from any available source.ParseErrorException - if template cannot be parsed due
to syntax (or other) error.java.lang.Exception - if an error occurs in template initializationpublic static java.lang.String getLoaderNameForResource(java.lang.String resourceName)
resourceName - Name of template or content resourcepublic static void warn(java.lang.Object message)
message - message to logpublic static void info(java.lang.Object message)
message - message to logpublic static void error(java.lang.Object message)
message - message to logpublic static void debug(java.lang.Object message)
message - message to logpublic static java.lang.String getString(java.lang.String key,
java.lang.String defaultValue)
key - A property key.defaultValue - default value to return if key not
found in resource manager.public static Directive getVelocimacro(java.lang.String vmName, java.lang.String templateName)
vmName - Name of velocimacro requestedtemplateName - The template from which the macro is requested.public static boolean addVelocimacro(java.lang.String name,
java.lang.String macro,
java.lang.String[] argArray,
java.lang.String sourceTemplate)
name - Name of a new velocimacro.macro - String form of the macro body.argArray - Array of strings, containing the
#macro() arguments. the 0th argument is the name.sourceTemplate - The template from which the macro is requested.public static boolean isVelocimacro(java.lang.String vmName,
java.lang.String templateName)
vmName - The name of velocimacro.templateName - The template from which the macro is requested.public static boolean dumpVMNamespace(java.lang.String namespace)
namespace - The namespace to dump.public static java.lang.String getString(java.lang.String key)
key - property keypublic static int getInt(java.lang.String key)
key - A property key.public static int getInt(java.lang.String key,
int defaultValue)
key - property keydefaultValue - default valuepublic static boolean getBoolean(java.lang.String key,
boolean def)
key - property keydef - default default value if property not foundpublic static org.apache.commons.collections.ExtendedProperties getConfiguration()