org.locomotive.module.display
Class DisplayPageHandler

java.lang.Object
  |
  +--org.locomotive.loco.handler.GenericHandler
        |
        +--org.locomotive.module.display.DisplayPageHandler

public class DisplayPageHandler
extends GenericHandler

DisplayPageHandler can be used to map a url into the path of a HTML template file in the file system. This gives the Handler 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
 
DisplayPageHandler 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 Handler, you have to have an entry for this class in your hrt.conf config file, ex:
disp org.locomotive.las.DisplayPageHandler
or, alternatively, you can invoke this Handler from another Handler:
 DisplayPageHandler disp = new DisplayPageHandler();
 disp.handleRequest(hd);
 


Fields inherited from class org.locomotive.loco.handler.GenericHandler
already_displayed_page, conn, DEBUG, ERROR, form_data, handler_uri, hd, NORMAL, session, steam_vars, url_tokens, user, WARNING
 
Constructor Summary
DisplayPageHandler()
           
 
Method Summary
 void handleRequest(HandlerData hd)
          main entry point called by RequestManager for each new request.
 boolean init(Log server_log)
          DisplayPageHandler doesn't do anything in the init() method.
 boolean shutdown(Log server_log)
          DisplayPageHandler doesn't do anything in the shutdown() method, either.
 
Methods inherited from class org.locomotive.loco.handler.GenericHandler
displayPage, displayString, handleException, log, logEvent, sayBadURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayPageHandler

public DisplayPageHandler()
Method Detail

init

public boolean init(Log server_log)
DisplayPageHandler doesn't do anything in the init() method.
Overrides:
init in class GenericHandler

shutdown

public boolean shutdown(Log server_log)
DisplayPageHandler doesn't do anything in the shutdown() method, either.
Overrides:
shutdown in class GenericHandler

handleRequest

public void handleRequest(HandlerData hd)
main entry point called by RequestManager for each new request.
Overrides:
handleRequest in class GenericHandler