org.apache.velocity.test
Class VelocityServletTest.MockVelocityServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.velocity.servlet.VelocityServlet
org.apache.velocity.test.VelocityServletTest.MockVelocityServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- Enclosing class:
- VelocityServletTest
- class VelocityServletTest.MockVelocityServlet
- extends VelocityServlet
Fields inherited from class javax.servlet.http.HttpServlet |
|
Fields inherited from class javax.servlet.GenericServlet |
|
Method Summary |
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)
|
Methods inherited from class org.apache.velocity.servlet.VelocityServlet |
chooseCharacterEncoding, createContext, doGet, doPost, doRequest, error, getTemplate, getTemplate, handleRequest, handleRequest, init, initVelocity, mergeTemplate, requestCleanup, setContentType |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VelocityServletTest.MockVelocityServlet
VelocityServletTest.MockVelocityServlet()
visibleSetContentType
void visibleSetContentType(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
loadConfiguration
protected java.util.Properties loadConfiguration(javax.servlet.ServletConfig config)
throws java.io.IOException
- Description copied from class:
VelocityServlet
- 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 class 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.
- Throws:
java.io.IOException
- I/O problem accessing the specified file, if specified.
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
Copyright ? 2002 Apache Software Foundation. All Rights Reserved.