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

See Also:
Serialized Form

Fields inherited from class org.apache.velocity.servlet.VelocityServlet
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, defaultContentType, INIT_PROPS_KEY, OLD_INIT_PROPS_KEY, REQUEST, RESPONSE, writerPool
 
Fields inherited from class javax.servlet.http.HttpServlet
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE
 
Fields inherited from class javax.servlet.GenericServlet
config
 
Constructor Summary
(package private) VelocityServletTest.MockVelocityServlet()
           
 
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, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, 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, registerNatives, toString, wait, wait, wait
 

Constructor Detail

VelocityServletTest.MockVelocityServlet

VelocityServletTest.MockVelocityServlet()
Method Detail

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
Following copied from class: org.apache.velocity.servlet.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.FileNotFoundException - if a specified file is not found.
java.io.IOException - I/O problem accessing the specified file, if specified.

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Overrides:
getServletConfig in class javax.servlet.GenericServlet


Copyright © 2002 Apache Software Foundation. All Rights Reserved.