org.locomotive.steam
Class SteamServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.locomotive.steam.SteamServlet

public class SteamServlet
extends javax.servlet.http.HttpServlet

SteamServlet can be used to interpret and display steam templates. The first time templates are read, they are automatically compiled can cached, for high performance. They are reloaded whenever the template file modification date changes. This class uses any extra path information it finds tacked on the the URL to figure out which template to display. If it doesn't find a file type suffix in the URL, it will automatically add ".tmpl" to the end of the URL. For instance:

 
 disp/base/main.tmpl     maps to $template.root/base/main.tmpl
 disp/base/main          maps to $template.root/base/main
 disp/base/general/page1 maps to $template.root/base/general/page1.tmpl
 
The $template.root variable is one of the properties that is loaded during servlet initialization. To set it, put the following line In your Servlet config file:

 template.root = /your/template/root/path
 
SteamServlet will not start up without this line in your configuration file. Consult your Servlet engine documentation on how to add configurations for Servlets.

See Also:
Serialized Form

Constructor Summary
SteamServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Send the requested page to the client, using the rules specified in the class documentation above.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          forwards the request to toGet()
 void init(javax.servlet.ServletConfig config)
          This Initializes the Cached Page Loader.
static java.lang.String shellEscape(java.lang.String s)
          Shell escapes a given string.
 
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, getServletConfig, getServletContext, getServletInfo, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SteamServlet

public SteamServlet()
Method Detail

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   java.io.IOException
forwards the request to toGet()
Overrides:
doPost in class javax.servlet.http.HttpServlet
See Also:
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws javax.servlet.ServletException,
                  java.io.IOException
Send the requested page to the client, using the rules specified in the class documentation above.
Overrides:
doGet in class javax.servlet.http.HttpServlet

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
This Initializes the Cached Page Loader. This takes a single input parameter: template.root which signifies the document root to load pages from. If this servlet is run inside the Locomotive, make sure you set the template root to the same place as the loco template root, or else all the other handlers will not operate correctly.
Overrides:
init in class javax.servlet.GenericServlet

shellEscape

public static java.lang.String shellEscape(java.lang.String s)
Shell escapes a given string. Currently remove the following:
|  <  >  !   $  ,  \