org.locomotive.module.display
Class DisplayPageServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.locomotive.loco.servlet.LocoServlet
                    |
                    +--org.locomotive.module.display.DisplayPageServlet

public class DisplayPageServlet
extends LocoServlet

DisplayPageServlet can be used to map a url into the path of a HTML template file in the file system. This gives the Servlet implementer an easy way to evaluate a hierarchy of templates with a given default or "generic" environment. For instance, this class would map urls beginning with "disp?base+generic" to the template root sub directory "base/generic" Therefore,

 
 disp?base+main          maps to $TEMPLATE_ROOT/base/main.tmpl
 disp?base+generic+page1 maps to $TEMPLATE_ROOT/base/generic/page1.tmpl
 disp?base+generic+page2 maps to $TEMPLATE_ROOT/base/generic/page2.tmpl
 
DisplayPageServlet will also log the Event of the generic template display, and neutralize any file system separators/operators from the url_tokens list for security purposes. In other words, all non-alphanumeric letters in the URL will be converted into a '/', meaning that each alphanumeric word will become a directory name except for the last, which becomes the name of the file.
In order to use this Servlet, you have to have an entry for this class in your servlet.conf config file, ex:
 disp          org.locomotive.module.display.DisplayPageServlet
 
or, alternatively, you can invoke this Servlet from another Servlet:
 RequestDispatcher reqd = getServletContext().getRequestDispatcher(
 handler_uri + "/disp?");
 reqd.forward(req, resp);
 

See Also:
Serialized Form

Fields inherited from class org.locomotive.loco.servlet.LocoServlet
conn, DEBUG, ERROR, form_data, NORMAL, req, resp, session, steam_vars, url_tokens, user, WARNING
 
Constructor Summary
DisplayPageServlet()
           
 
Method Summary
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          main entry point.
 
Methods inherited from class org.locomotive.loco.servlet.LocoServlet
displayPage, displayString, handleException, log, logEvent, sayBadURL, setup
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayPageServlet

public DisplayPageServlet()
Method Detail

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse resp)
             throws javax.servlet.ServletException,
                    java.io.IOException
main entry point.
Overrides:
service in class LocoServlet
Tags copied from class: LocoServlet
See Also:
LocoServlet.setup(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), javax.servlet.http.HttpServlet.html#service