Uses of Interface
org.apache.velocity.context.Context
Package
Description
-
Uses of Context in org.apache.velocity
Modifier and TypeClassDescriptionclass
General purpose implementation of the application Context interface for general application use.Modifier and TypeMethodDescriptionvoid
The AST node structure is merged with the context to produce the final output.void
The AST node structure is merged with the context to produce the final output.ModifierConstructorDescriptionVelocityContext
(Map<String, Object> context, Context innerContext) Initializes internal storage (never tonull
), and inner context.VelocityContext
(Context innerContext) Chaining constructor, used when you want to wrap a context in another. -
Uses of Context in org.apache.velocity.app
Modifier and TypeMethodDescriptionstatic boolean
Renders the input reader using the context into the output writer.static boolean
renders the input string using the context into the output writer.boolean
Renders the input reader using the context into the output writer.boolean
renders the input string using the context into the output writer.static boolean
Velocity.invokeVelocimacro
(String vmName, String logTag, String[] params, Context context, Writer writer) Invokes a currently registered Velocimacro with the params provided and places the rendered stream into the writer.boolean
VelocityEngine.invokeVelocimacro
(String vmName, String logTag, String[] params, Context context, Writer writer) Invokes a currently registered Velocimacro with the params provided and places the rendered stream into the writer.static boolean
Velocity.mergeTemplate
(String templateName, String encoding, Context context, Writer writer) Merges a template and puts the rendered stream into the writerboolean
VelocityEngine.mergeTemplate
(String templateName, String encoding, Context context, Writer writer) merges a template and puts the rendered stream into the writer -
Uses of Context in org.apache.velocity.app.event
Modifier and TypeMethodDescriptionfinal boolean
EventCartridge.attachToContext
(Context context) Attached the EventCartridge to the context Final because not something one should mess with lightly :)EventCartridge.includeEvent
(Context context, String includeResourcePath, String currentResourcePath, String directiveName) Call include event handlersIncludeEventHandler.includeEvent
(Context context, String includeResourcePath, String currentResourcePath, String directiveName) Called when an include-type directive is encountered (#include
or#parse
).EventCartridge.invalidGetMethod
(Context context, String reference, Object object, String property, Info info) Call invalid reference handlers for an invalid getterInvalidReferenceEventHandler.invalidGetMethod
(Context context, String reference, Object object, String property, Info info) Called when object is null or there is no getter for the given property.EventCartridge.invalidMethod
(Context context, String reference, Object object, String method, Info info) Call invalid reference handlers for an invalid method callInvalidReferenceEventHandler.invalidMethod
(Context context, String reference, Object object, String method, Info info) Called when object is null or the given method does not exist.boolean
EventCartridge.invalidSetMethod
(Context context, String leftreference, String rightreference, Info info) Call invalid reference handlers for an invalid setterboolean
InvalidReferenceEventHandler.invalidSetMethod
(Context context, String leftreference, String rightreference, Info info) Called when object is null or there is no setter for the given property.EventCartridge.methodException
(Context context, Class<?> claz, String method, Exception e, Info info) Call method exception event handlerMethodExceptionEventHandler.methodException
(Context context, Class<?> claz, String method, Exception e, Info info) Called when a method throws an exception.ReferenceInsertionEventHandler.referenceInsert
(Context context, String reference, Object value) A call-back which is executed during Velocity merge before a reference value is inserted into the output stream. -
Uses of Context in org.apache.velocity.app.event.implement
Modifier and TypeMethodDescriptionIncludeNotFound.includeEvent
(Context context, String includeResourcePath, String currentResourcePath, String directiveName) Check to see if included file exists, and display "not found" page if it doesn't.IncludeRelativePath.includeEvent
(Context context, String includeResourcePath, String currentResourcePath, String directiveName) Return path relative to the current template's path.ReportInvalidReferences.invalidGetMethod
(Context context, String reference, Object object, String property, Info info) Collect the error and/or throw an exception, depending on configuration.ReportInvalidReferences.invalidMethod
(Context context, String reference, Object object, String method, Info info) Collect the error and/or throw an exception, depending on configuration.boolean
ReportInvalidReferences.invalidSetMethod
(Context context, String leftreference, String rightreference, Info info) Collect the error and/or throw an exception, depending on configuration.PrintExceptions.methodException
(Context context, Class<?> claz, String method, Exception e, Info info) Render the method exception, and optionally the exception message and stack trace.EscapeReference.referenceInsert
(Context context, String reference, Object value) Escape the provided text if it matches the configured regular expression.void
IncludeNotFound.setContext
(Context context) -
Uses of Context in org.apache.velocity.context
Modifier and TypeInterfaceDescriptioninterface
interface to bring all necessary internal and user contexts together.Modifier and TypeClassDescriptionclass
This class is the abstract base class for all conventional Velocity Context implementations.class
This is an abstract internal-use-only context implementation to be used as a subclass for other internal-use-only contexts that wrap other internal-use-only contexts.final class
This adapter class is the container for all context types for internal use.Modifier and TypeMethodDescriptionAbstractContext.getChainedContext()
returns innerContext if one is chainedChainedInternalContextAdapter.getInternalUserContext()
Return the inner / user context.InternalContextAdapterImpl.getInternalUserContext()
returns the user data context that we are wrappingInternalWrapperContext.getInternalUserContext()
Returns the wrapped user context.ModifierConstructorDescriptionAbstractContext
(Context inner) Chaining constructor accepts a Context argument.CTOR takes a Context and wraps it, delegating all 'data' calls to it. -
Uses of Context in org.apache.velocity.example
Modifier and TypeClassDescriptionclass
Example context impl that uses a database to store stuff :) yes, this is silly expects a mysql db test with table CREATE TABLE contextstore ( k varchar(100), val blob ); very fragile, crappy code....class
Example context impl that uses a TreeMap Not much point other than to show how easy it is.Modifier and TypeMethodDescriptionEventExample.invalidGetMethod
(Context context, String reference, Object object, String property, Info info) EventExample.invalidMethod
(Context context, String reference, Object object, String method, Info info) boolean
EventExample.invalidSetMethod
(Context context, String leftreference, String rightreference, Info info) Event handler for when the right hand side of a #set() directive is null, which results in a log message.EventExample.referenceInsert
(Context context, String reference, Object value) Event handler for when a reference is inserted into the output stream. -
Uses of Context in org.apache.velocity.runtime
Modifier and TypeMethodDescriptionboolean
Renders the input reader using the context into the output writer.boolean
Renders the input string using the context into the output writer.boolean
Renders the input reader using the context into the output writer.boolean
Renders the input string using the context into the output writer.boolean
RuntimeInstance.invokeVelocimacro
(String vmName, String logTag, String[] params, Context context, Writer writer) Invokes a currently registered Velocimacro with the params provided and places the rendered stream into the writer.boolean
RuntimeServices.invokeVelocimacro
(String vmName, String logTag, String[] params, Context context, Writer writer) Invokes a currently registered Velocimacro with the params provided and places the rendered stream into the writer.boolean
RuntimeInstance.render
(Context context, Writer writer, String logTag, SimpleNode nodeTree) Initializes and renders the ASTSimpleNode
using the context into the output writer. -
Uses of Context in org.apache.velocity.util
Modifier and TypeMethodDescriptionvoid
ContextAware.setContext
(Context context) Initialize the EventHandler.