类 ServletUtils
java.lang.Object
org.apache.velocity.tools.view.ServletUtils
A set of utility methods for supporting and using VelocityTools in the servlet environment.
- 版本:
- $Id: ServletUtils.java 471244 2006-11-04 18:34:38Z henning $
-
字段概要
字段修饰符和类型字段说明static final Stringstatic final StringKey used to access a liveFactoryConfigurationpreviously placed in the ServletContext attributes.static final ServletUtilsstatic final Stringstatic final String -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static StringcombinePath(String before, String after) If end is null, this will return start and vice versa.static Objectstatic ObjectfindTool(String key, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.ServletContext application) static Objectstatic Objectstatic ObjectfindTool(String key, String toolboxKey, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.ServletContext application) static Objectstatic FactoryConfigurationgetConfiguration(jakarta.servlet.ServletContext application) static FactoryConfigurationgetConfiguration(String path, jakarta.servlet.ServletContext application) static InputStreamgetInputStream(String path, jakarta.servlet.ServletContext application) static ObjectReturns a mutex (lock object) unique to the specified session and stored under the specified key to allow for reliable synchronization on the session.static StringgetPath(jakarta.servlet.http.HttpServletRequest request) Retrieves the path for the specified request regardless of whether this is a direct request or an include by the RequestDispatcher.static URLstatic VelocityViewgetVelocityView(jakarta.servlet.FilterConfig config) Returns the sharedVelocityViewfor the specifiedFilterConfig's context.static VelocityViewgetVelocityView(jakarta.servlet.ServletConfig config) Returns the sharedVelocityViewfor the specifiedServletConfig's context.static VelocityViewgetVelocityView(jakarta.servlet.ServletContext application) Returns the sharedVelocityViewfor the specifiedServletContext.static VelocityViewgetVelocityView(jakarta.servlet.ServletContext application, boolean createIfMissing) Returns the sharedVelocityViewfor the specifiedServletContext.static VelocityViewgetVelocityView(JeeConfig config) Returns the sharedVelocityViewfor the specifiedJeeConfig's context.protected static booleanisWebappResource(String path)
-
字段详细资料
-
VELOCITY_VIEW_KEY
-
SHARED_CONFIG_PARAM
- 另请参阅:
-
ALT_VELOCITY_VIEW_KEY
- 另请参阅:
-
CONFIGURATION_KEY
Key used to access a liveFactoryConfigurationpreviously placed in the ServletContext attributes.- 另请参阅:
-
INSTANCE
-
-
构造器详细资料
-
ServletUtils
protected ServletUtils()
-
-
方法详细资料
-
getInstance
-
getPath
Retrieves the path for the specified request regardless of whether this is a direct request or an include by the RequestDispatcher.- 参数:
request- servlet request- 返回:
- request path
-
getVelocityView
Returns the sharedVelocityViewfor the specifiedServletConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.- 参数:
config- servlet config- 返回:
- VelocityView instance
-
getVelocityView
Returns the sharedVelocityViewfor the specifiedFilterConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.- 参数:
config- filter config- 返回:
- VelocityView instance
-
getVelocityView
Returns the sharedVelocityViewfor the specifiedJeeConfig's context. If one has not yet been created, it will create, store it for future access, and then return it.- 参数:
config- configuration parameters container (webapp, servlet or filter)- 返回:
- VelocityView instance
-
getVelocityView
Returns the sharedVelocityViewfor the specifiedServletContext. If one has not yet been created, it will create one, store it for future access, and then return it.- 参数:
application- servlet context- 返回:
- VelocityView instance
-
getVelocityView
public static VelocityView getVelocityView(jakarta.servlet.ServletContext application, boolean createIfMissing) Returns the sharedVelocityViewfor the specifiedServletContext. If one has not yet been created and the second parameter istrue, then it will create one, store it for future access, and return it.- 参数:
application- servlet contextcreateIfMissing- whether to create VelocityView if not yet built- 返回:
- VelocityView instance
-
findTool
-
findTool
-
findTool
-
findTool
-
findTool
-
findTool
-
isWebappResource
-
getInputStream
-
getURL
-
getConfiguration
-
getConfiguration
public static FactoryConfiguration getConfiguration(String path, jakarta.servlet.ServletContext application) -
getMutex
Returns a mutex (lock object) unique to the specified session and stored under the specified key to allow for reliable synchronization on the session.- 参数:
session- HTTP sessionkey- mutex keycaller- caller object- 返回:
- session mutex object
-
combinePath
If end is null, this will return start and vice versa. If neither is null, this will append the end to the start, making sure that there is only one '/' character between the two values.- 参数:
before- start pathafter- end path- 返回:
- combined path
-