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

java.lang.Object
  extended by org.apache.velocity.tools.view.ViewToolInfo
      extended by 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 521403 2007-03-22 18:47:56Z nbubna $
Author:
Nathan Bubna

Field Summary
private  boolean exactPath
           
private  java.lang.String path
           
private  java.lang.String scope
           
 
Fields inherited from class org.apache.velocity.tools.view.ViewToolInfo
LOG
 
Constructor Summary
ServletToolInfo()
           
 
Method Summary
 boolean allowsRequestPath(java.lang.String requestedPath)
           
 java.lang.String getRequestPath()
           
 java.lang.String getScope()
           
 void setRequestPath(java.lang.String path)
           
 void setScope(java.lang.String scope)
           
 
Methods inherited from class org.apache.velocity.tools.view.ViewToolInfo
getApplicationClass, getClassname, getInstance, getKey, getParameters, setClassname, setKey, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scope

private java.lang.String scope

exactPath

private boolean exactPath

path

private java.lang.String path
Constructor Detail

ServletToolInfo

public ServletToolInfo()
Method Detail

setScope

public void setScope(java.lang.String scope)

getScope

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

setRequestPath

public void setRequestPath(java.lang.String path)
Parameters:
path - the full or partial request path restriction of the tool
Since:
VelocityTools 1.3

getRequestPath

public java.lang.String getRequestPath()
Returns:
request path restriction for this tool
Since:
VelocityTools 1.3

allowsRequestPath

public boolean allowsRequestPath(java.lang.String requestedPath)
Parameters:
requestedPath - the path of the current servlet request
Returns:
true if the path of the specified request path matches the request path of this tool. If there is no request path restriction for this tool, it will always return true.
Since:
VelocityTools 1.3


Copyright (c) 2003-2007 Apache Software Foundation