class VelocityServletTest.MockVelocityServlet extends VelocityServlet
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, INIT_PROPS_KEY, REQUEST, RESPONSE| Constructor and Description |
|---|
VelocityServletTest.MockVelocityServlet() |
| Modifier and Type | Method and Description |
|---|---|
javax.servlet.ServletConfig |
getServletConfig() |
protected java.util.Properties |
loadConfiguration(javax.servlet.ServletConfig config)
Loads the configuration information and returns that
information as a Properties, which will be used to
initialize the Velocity runtime.
|
(package private) void |
visibleSetContentType(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
chooseCharacterEncoding, createContext, doGet, doPost, doRequest, error, getTemplate, getTemplate, handleRequest, handleRequest, init, initVelocity, mergeTemplate, requestCleanup, setContentTypedoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceVelocityServletTest.MockVelocityServlet()
void visibleSetContentType(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
protected java.util.Properties loadConfiguration(javax.servlet.ServletConfig config)
throws java.io.IOException
VelocityServlet
<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.
loadConfiguration in class VelocityServletconfig - ServletConfig passed to the servlets init() function
Can be used to access the real path via ServletContext (hint)java.io.FileNotFoundException - if a specified file is not found.java.io.IOException - I/O problem accessing the specified file, if specified.public javax.servlet.ServletConfig getServletConfig()
getServletConfig in interface javax.servlet.ServletgetServletConfig in class javax.servlet.GenericServletCopyright ? 2002 Apache Software Foundation. All Rights Reserved.