Interface VelocityManager


  • @Role
    public interface VelocityManager
    Provides access to the main XWiki Velocity objects.
    Since:
    1.5M2
    Version:
    $Id: 28deb701e8e553e3ed33925b6462835fc9f61a66 $
    • Method Detail

      • getVelocityContext

        org.apache.velocity.VelocityContext getVelocityContext()
        Returns:
        the up to date current Velocity Context
      • getCurrentVelocityContext

        default org.apache.velocity.VelocityContext getCurrentVelocityContext()
        Returns:
        the current Velocity Context without any modification
        Since:
        8.3M1
      • getVelocityEngine

        VelocityEngine getVelocityEngine()
                                  throws XWikiVelocityException
        Get the current Velocity Engine or create one if none has been created.
        Returns:
        the current Velocity Engine retrieved from the Execution Context
        Throws:
        XWikiVelocityException - if the Velocity Engine cannot be created
      • evaluate

        default boolean evaluate​(Writer out,
                                 String templateName,
                                 Reader source)
                          throws XWikiVelocityException
        Renders the input string using the context into the output writer.

        The current ScriptContext will be used and updated after the execution.

        Anything set in the current VelocityContext will also be taken into account.

        Parameters:
        out - the writer in which to render the output
        templateName - the string to be used as the template name for log messages in case of error. Also used internally by Velocity as a cache index key for caching macros.
        source - the input containing the VTL to be rendered, as a Reader
        Returns:
        false if empty, true otherwise
        Throws:
        XWikiVelocityException - in case of error
        Since:
        8.3M1