org.apache.turbine.modules.actions

## Class VelocityAction

- java.lang.Object
- - org.apache.turbine.modules.Assembler
  - - org.apache.turbine.modules.Action
    - - org.apache.turbine.modules.ActionEvent
      - - org.apache.turbine.util.velocity.VelocityActionEvent
        - - org.apache.turbine.modules.actions.VelocityAction

- Direct Known Subclasses:
    LegacyVelocityAction, VelocitySecureAction

      public abstract class VelocityAction
      extends VelocityActionEvent

  This class provides a convenience methods for Velocity Actions to use. Since this class is abstract, it should only be extended and not used directly.
  Version:
    $Id: VelocityAction.java 1706425 2015-10-02 14:47:51Z tv $
  Author:
    Jon S. Stevens, Jason van Zyl, Peter Courcoux

- - ### Field Summary

    - ### Fields inherited from class org.apache.turbine.util.velocity.VelocityActionEvent

      `initialized, velocity`

    - ### Fields inherited from class org.apache.turbine.modules.ActionEvent

      `bubbleUpException, BUTTON, BUTTON_LENGTH, DEFAULT_METHOD, LENGTH, log, METHOD_NAME_LENGTH, METHOD_NAME_PREFIX`

    - ### Fields inherited from class org.apache.turbine.modules.Action

      `CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VelocityAction()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `doPerform(PipelineData pipelineData, org.apache.velocity.context.Context context)` You SHOULD override this method and implement it in your action.
    `void` | `initialize()` Initialize the module.
    `protected void` | `perform(PipelineData pipelineData)` Sets up the context and then calls super.perform(); thus, subclasses don't have to worry about getting a context themselves!
    `void` | `setTemplate(PipelineData pipelineData, String template)` This method is used when you want to short circuit an Action and change the template that will be executed next.

    - ### Methods inherited from class org.apache.turbine.util.velocity.VelocityActionEvent

      `doPerform`

    - ### Methods inherited from class org.apache.turbine.modules.ActionEvent

      `considerKey, executeEvents, formatString, getMethod`

    - ### Methods inherited from class org.apache.turbine.modules.Action

      `getPrefix`

    - ### Methods inherited from class org.apache.turbine.modules.Assembler

      `getRunData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VelocityAction

          public VelocityAction()

  - ### Method Detail

    - #### initialize

          public void initialize()
                          throws Exception

      Initialize the module.
      Specified by:
        `initialize` in class `VelocityActionEvent`
      Throws:
        `Exception` - a generic exception.

    - #### doPerform

          public abstract void doPerform(PipelineData pipelineData,
                       org.apache.velocity.context.Context context)
                                  throws Exception

      You SHOULD override this method and implement it in your action.
      Parameters:
        `pipelineData` - Turbine information.
        `context` - Context for web pages.
      Throws:
        `Exception` - a generic exception.

    - #### perform

          protected void perform(PipelineData pipelineData)
                          throws Exception

      Sets up the context and then calls super.perform(); thus, subclasses don't have to worry about getting a context themselves! If a subclass throws an exception then depending on whether action.event.bubbleexception is true, then it bubbles it farther up, or traps it there.
      Overrides:
        `perform` in class `Action`
      Parameters:
        `pipelineData` - Turbine information.
      Throws:
        `Exception` - a generic exception.

    - #### setTemplate

          public void setTemplate(PipelineData pipelineData,
                         String template)

      This method is used when you want to short circuit an Action and change the template that will be executed next.
      Parameters:
        `pipelineData` - Turbine information.
        `template` - The template that will be executed next.

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.