org.apache.velocity.tools.view.servlet
Class ServletToolInfo

java.lang.Object
  |
  +--org.apache.velocity.tools.view.ViewToolInfo
        |
        +--org.apache.velocity.tools.view.servlet.ServletToolInfo
All Implemented Interfaces:
ToolInfo

public class ServletToolInfo
extends ViewToolInfo

ToolInfo implementation that holds scope information for tools used in a servlet environment. The ServletToolboxManager uses this to allow tool definitions to specify the scope/lifecycle of individual view tools.

Example of toolbox.xml definitions for servlet tools:

  <tool>
    <key>link</key>
    <scope>request</scope>
    <class>org.apache.velocity.tools.struts.StrutsLinkTool</class>
  </tool>
  <tool>
    <key>math</key>
    <scope>application</scope>
    <class>org.apache.velocity.tools.generic.MathTool</class>
  </tool>
  <tool>
    <key>user</key>
    <scope>session</scope>
    <class>com.mycompany.tools.MyUserTool</class>
  </tool>
  

Version:
$Id: ServletToolInfo.java,v 1.3 2003/05/28 00:17:16 nbubna Exp $
Author:
Nathan Bubna

Field Summary
static java.lang.String APPLICATION_SCOPE
           
static java.lang.String REQUEST_SCOPE
           
private  java.lang.String scope
           
static java.lang.String SESSION_SCOPE
           
 
Fields inherited from class org.apache.velocity.tools.view.ViewToolInfo
 
Constructor Summary
ServletToolInfo(java.lang.String key, java.lang.String classname, java.lang.String scope)
          Creates a new tool of the specified class with the given key and scope.
 
Method Summary
 java.lang.String getScope()
           
 
Methods inherited from class org.apache.velocity.tools.view.ViewToolInfo
getClassname, getInstance, getKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_SCOPE

public static final java.lang.String REQUEST_SCOPE
See Also:
Constant Field Values

SESSION_SCOPE

public static final java.lang.String SESSION_SCOPE
See Also:
Constant Field Values

APPLICATION_SCOPE

public static final java.lang.String APPLICATION_SCOPE
See Also:
Constant Field Values

scope

private java.lang.String scope
Constructor Detail

ServletToolInfo

public ServletToolInfo(java.lang.String key,
                       java.lang.String classname,
                       java.lang.String scope)
                throws java.lang.Exception
Creates a new tool of the specified class with the given key and scope.

Method Detail

getScope

public java.lang.String getScope()
Returns:
the scope of the tool


Copyright (c) 2003 Apache Software Foundation