org.locomotive.loco.handler
Interface Handler
- All Known Implementing Classes:
- DefaultHandler, GenericHandler, PermHandler, ServerHandler, UnknownHandler
- public interface Handler
The Locomotive requires a generic way to instantiate a class and
have it handle a request; the Handler interface provides it. Any
class that implements the Handler interface can be called by the
Locotive to handle a request. The way the Locomotive knows to
call a particular Handler is through a handler token mapping
in the hrt.conf file, which matches a url token with Class name.
In the hrt.conf file, you can also specify a path to a properties
file to be loaded for this particular handler. The properties file
can be accessed using the handler_config field in HandlerData or
with the Loco.getHandlerProperties(Handler h) call.
Method Summary |
void |
handleRequest(HandlerData hd_in)
this is the entry point for the server for a specific Request. |
boolean |
init(Log server_log)
Called by the HandlerRoutingTable when loaded/linked. |
boolean |
shutdown(Log server_log)
Called by the Locomotive when the server is exiting. |
handleRequest
public void handleRequest(HandlerData hd_in)
- this is the entry point for the server for a specific Request.
This class is fetched by the HandlerRoutingTable if the
pattern matches (specified in the HandlerRoutingTable config file)
init
public boolean init(Log server_log)
- Called by the HandlerRoutingTable when loaded/linked.
Might be useful for loading external data into staticly
available caches. (Note: ideally, this should be a static method,
but Java doesn't allow us to declare static methods in Interfaces)
shutdown
public boolean shutdown(Log server_log)
- Called by the Locomotive when the server is exiting.
You can also call init() and shutdown() yourself to reload this
class.