org.apache.velocity.tools.view
public class ServletUtils extends java.lang.Object
A set of utility methods for supporting and using VelocityTools in the servlet environment.
Modifier and Type | Class and Description |
---|---|
private static class |
ServletUtils.SessionMutex |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALT_VELOCITY_VIEW_KEY |
static java.lang.String |
CONFIGURATION_KEY
Key used to access a live
FactoryConfiguration previously
placed in the ServletContext attributes. |
static ServletUtils |
INSTANCE |
static java.lang.String |
SHARED_CONFIG_PARAM |
static java.lang.String |
VELOCITY_VIEW_KEY |
Modifier | Constructor and Description |
---|---|
protected |
ServletUtils() |
Modifier and Type | Method and Description |
---|---|
private static VelocityView |
createView(java.lang.Class klass,
JeeConfig config) |
private static VelocityView |
createView(JeeConfig config) |
static java.lang.Object |
findTool(java.lang.String key,
HttpServletRequest request) |
static java.lang.Object |
findTool(java.lang.String key,
HttpServletRequest request,
ServletContext application) |
static java.lang.Object |
findTool(java.lang.String key,
ServletContext application) |
static java.lang.Object |
findTool(java.lang.String key,
java.lang.String toolboxKey,
HttpServletRequest request) |
static java.lang.Object |
findTool(java.lang.String key,
java.lang.String toolboxKey,
HttpServletRequest request,
ServletContext application) |
static java.lang.Object |
findTool(java.lang.String key,
java.lang.String toolboxKey,
ServletContext application) |
static FactoryConfiguration |
getConfiguration(ServletContext application) |
static FactoryConfiguration |
getConfiguration(java.lang.String path,
ServletContext application) |
static FactoryConfiguration |
getConfiguration(java.lang.String path,
ServletContext application,
boolean deprecationSupportMode) |
static java.io.InputStream |
getInputStream(java.lang.String path,
ServletContext application) |
ServletUtils |
getInstance() |
static java.lang.Object |
getMutex(HttpSession session,
java.lang.String key,
java.lang.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 java.lang.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(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 . |
public static final java.lang.String VELOCITY_VIEW_KEY
public static final java.lang.String SHARED_CONFIG_PARAM
public static final java.lang.String ALT_VELOCITY_VIEW_KEY
public static final java.lang.String CONFIGURATION_KEY
FactoryConfiguration
previously
placed in the ServletContext attributes.public static final ServletUtils INSTANCE
public ServletUtils getInstance()
public static java.lang.String getPath(HttpServletRequest request)
public static VelocityView getVelocityView(ServletConfig config)
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.public static VelocityView getVelocityView(FilterConfig config)
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.private static VelocityView createView(JeeConfig config)
private static VelocityView createView(java.lang.Class klass, JeeConfig config)
public static VelocityView getVelocityView(ServletContext application)
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.public static VelocityView getVelocityView(ServletContext application, boolean createIfMissing)
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.public static java.lang.Object findTool(java.lang.String key, ServletContext application)
public static java.lang.Object findTool(java.lang.String key, java.lang.String toolboxKey, ServletContext application)
public static java.lang.Object findTool(java.lang.String key, HttpServletRequest request)
public static java.lang.Object findTool(java.lang.String key, java.lang.String toolboxKey, HttpServletRequest request)
public static java.lang.Object findTool(java.lang.String key, HttpServletRequest request, ServletContext application)
public static java.lang.Object findTool(java.lang.String key, java.lang.String toolboxKey, HttpServletRequest request, ServletContext application)
public static java.io.InputStream getInputStream(java.lang.String path, ServletContext application)
public static FactoryConfiguration getConfiguration(ServletContext application)
public static FactoryConfiguration getConfiguration(java.lang.String path, ServletContext application)
public static FactoryConfiguration getConfiguration(java.lang.String path, ServletContext application, boolean deprecationSupportMode)
public static java.lang.Object getMutex(HttpSession session, java.lang.String key, java.lang.Object caller)
Copyright (c) 2003-2007 Apache Software Foundation