org.apache.velocity.tools.view
Class ServletUtils

java.lang.Object
  extended by org.apache.velocity.tools.view.ServletUtils
Direct Known Subclasses:
ServletUtils

public class ServletUtils
extends Object

A set of utility methods for supporting and using VelocityTools in the servlet environment.

Version:
$Id: ServletUtils.java 471244 2006-11-04 18:34:38Z henning $

Field Summary
static String ALT_VELOCITY_VIEW_KEY
           
static String CONFIGURATION_KEY
          Key used to access a live FactoryConfiguration previously placed in the ServletContext attributes.
static ServletUtils INSTANCE
           
static String SHARED_CONFIG_PARAM
           
static String VELOCITY_VIEW_KEY
           
 
Constructor Summary
protected ServletUtils()
           
 
Method Summary
static Object findTool(String key, HttpServletRequest request)
           
static Object findTool(String key, HttpServletRequest request, ServletContext application)
           
static Object findTool(String key, ServletContext application)
           
static Object findTool(String key, String toolboxKey, HttpServletRequest request)
           
static Object findTool(String key, String toolboxKey, HttpServletRequest request, ServletContext application)
           
static Object findTool(String key, String toolboxKey, ServletContext application)
           
static FactoryConfiguration getConfiguration(ServletContext application)
           
static FactoryConfiguration getConfiguration(String path, ServletContext application)
           
static FactoryConfiguration getConfiguration(String path, ServletContext application, boolean deprecationSupportMode)
           
static InputStream getInputStream(String path, ServletContext application)
           
 ServletUtils getInstance()
           
static Object getMutex(HttpSession session, String key, Object caller)
          Returns a mutex (lock object) unique to the specified session and stored under the specified key to allow for reliable synchronization on the session.
static String getPath(HttpServletRequest request)
          Retrieves the path for the specified request regardless of whether this is a direct request or an include by the RequestDispatcher.
static VelocityView getVelocityView(FilterConfig config)
          Returns the shared VelocityView for the specified FilterConfig's context.
static VelocityView getVelocityView(JeeConfig config)
          Returns the shared VelocityView for the specified JeeConfig's context.
static VelocityView getVelocityView(ServletConfig config)
          Returns the shared VelocityView for the specified ServletConfig's context.
static VelocityView getVelocityView(ServletContext application)
          Returns the shared VelocityView for the specified ServletContext.
static VelocityView getVelocityView(ServletContext application, boolean createIfMissing)
          Returns the shared VelocityView for the specified ServletContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VELOCITY_VIEW_KEY

public static final String VELOCITY_VIEW_KEY

SHARED_CONFIG_PARAM

public static final String SHARED_CONFIG_PARAM
See Also:
Constant Field Values

ALT_VELOCITY_VIEW_KEY

public static final String ALT_VELOCITY_VIEW_KEY
See Also:
Constant Field Values

CONFIGURATION_KEY

public static final String CONFIGURATION_KEY
Key used to access a live FactoryConfiguration previously placed in the ServletContext attributes.

See Also:
Constant Field Values

INSTANCE

public static final ServletUtils INSTANCE
Constructor Detail

ServletUtils

protected ServletUtils()
Method Detail

getInstance

public ServletUtils getInstance()

getPath

public static String getPath(HttpServletRequest request)
Retrieves the path for the specified request regardless of whether this is a direct request or an include by the RequestDispatcher.


getVelocityView

public static VelocityView getVelocityView(ServletConfig config)
Returns the shared VelocityView for the specified ServletConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.


getVelocityView

public static VelocityView getVelocityView(FilterConfig config)
Returns the shared VelocityView for the specified FilterConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.


getVelocityView

public static VelocityView getVelocityView(JeeConfig config)
Returns the shared VelocityView for the specified JeeConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.


getVelocityView

public static VelocityView getVelocityView(ServletContext application)
Returns the shared VelocityView for the specified ServletContext. If one has not yet been created, it will create one, store it for future access, and then return it.


getVelocityView

public static VelocityView getVelocityView(ServletContext application,
                                           boolean createIfMissing)
Returns the shared VelocityView for the specified ServletContext. If one has not yet been created and the second parameter is true, then it will create one, store it for future access, and return it.


findTool

public static Object findTool(String key,
                              ServletContext application)

findTool

public static Object findTool(String key,
                              String toolboxKey,
                              ServletContext application)

findTool

public static Object findTool(String key,
                              HttpServletRequest request)

findTool

public static Object findTool(String key,
                              String toolboxKey,
                              HttpServletRequest request)

findTool

public static Object findTool(String key,
                              HttpServletRequest request,
                              ServletContext application)

findTool

public static Object findTool(String key,
                              String toolboxKey,
                              HttpServletRequest request,
                              ServletContext application)

getInputStream

public static InputStream getInputStream(String path,
                                         ServletContext application)

getConfiguration

public static FactoryConfiguration getConfiguration(ServletContext application)

getConfiguration

public static FactoryConfiguration getConfiguration(String path,
                                                    ServletContext application)

getConfiguration

public static FactoryConfiguration getConfiguration(String path,
                                                    ServletContext application,
                                                    boolean deprecationSupportMode)

getMutex

public static Object getMutex(HttpSession session,
                              String key,
                              Object caller)
Returns a mutex (lock object) unique to the specified session and stored under the specified key to allow for reliable synchronization on the session.



Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.