Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
HttpServlet
org.apache.velocity.servlet.VelocityServlet
org.apache.velocity.test.VelocityServletTest.MockVelocityServlet
(package private) class VelocityServletTest.MockVelocityServlet
extends VelocityServlet
Field Summary |
Fields inherited from class org.apache.velocity.servlet.VelocityServlet | |
CONTENT_TYPE , DEFAULT_CONTENT_TYPE , DEFAULT_OUTPUT_ENCODING , INIT_PROPS_KEY , OLD_INIT_PROPS_KEY , REQUEST , RESPONSE , defaultContentType , writerPool |
Method Summary | |
ServletConfig | |
protected Properties |
|
(package private) void |
|
Methods inherited from class org.apache.velocity.servlet.VelocityServlet | |
chooseCharacterEncoding , createContext , doGet , doPost , doRequest , error , getTemplate , getTemplate , handleRequest , handleRequest , init , initVelocity , loadConfiguration , mergeTemplate , requestCleanup , setContentType |
public ServletConfig getServletConfig()
protected Properties loadConfiguration(ServletConfig config) throws IOException
Loads the configuration information and returns that information as a Properties, which will be used to initialize the Velocity runtime.
Currently, this method gets the initialization parameter VelocityServlet.INIT_PROPS_KEY, which should be a file containing the configuration information.
To configure your Servlet Spec 2.2 compliant servlet runner to pass this to you, put the following in your WEB-INF/web.xml file
<servlet> <servlet-name> YourServlet </servlet-name> <servlet-class> your.package.YourServlet </servlet-class> <init-param> <param-name> org.apache.velocity.properties </param-name> <param-value> velocity.properties </param-value> </init-param> </servlet>Alternately, if you wish to configure an entire context in this fashion, you may use the following:
<context-param> <param-name> org.apache.velocity.properties </param-name> <param-value> velocity.properties </param-value> <description> Path to Velocity configuration </description> </context-param>Derived classes may do the same, or take advantage of this code to do the loading for them via :Properties p = super.loadConfiguration( config );and then add or modify the configuration values from the file.
- Overrides:
- loadConfiguration in interface VelocityServlet
- Parameters:
config
- ServletConfig passed to the servlets init() function Can be used to access the real path via ServletContext (hint)
- Returns:
- java.util.Properties loaded with configuration values to be used to initialize the Velocity runtime.
(package private) void visibleSetContentType(HttpServletRequest req, HttpServletResponse res)