org.locomotive.loco.handler
Class HandlerRoutingTable

java.lang.Object
  |
  +--org.locomotive.server.ServiceRoutingTable
        |
        +--org.locomotive.loco.handler.HandlerRoutingTable

public class HandlerRoutingTable
extends ServiceRoutingTable

Used to choose which handler classes get invoked. Used by the RequestManager. Has some preset defaults- see putInDefaults


Inner Class Summary
protected  class HandlerRoutingTable.HandlerEntry
           
 
Inner classes inherited from class org.locomotive.server.ServiceRoutingTable
ServiceRoutingTable.ServiceEntry
 
Field Summary
protected  Log server_log
           
 
Fields inherited from class org.locomotive.server.ServiceRoutingTable
AVAILABLE, PERMANENTLY_UNAVAILABLE, server_log, service_configs, service_extensions_hash, service_tokens_hash, SHUTDOWN, UNAVAILABLE_AND_WAITING
 
Constructor Summary
HandlerRoutingTable(java.lang.String path, Log log, java.util.Vector classpath, boolean auto_reload)
          creates a new (but uninitialized) HanderManager
 
Method Summary
protected  ServiceRoutingTable.ServiceEntry createServiceEntry(java.lang.String pattern, java.lang.String classname, java.lang.String config_path)
          Adds the a HandlerEntry to the service_hash.
protected  void putInDefaults()
          Overrides the superclass to put in the default handlers.
 void routeRequest(int request_id, java.net.Socket sock, java.io.InputStream is, java.io.OutputStream os, java.util.Hashtable cgi_envars, java.util.Hashtable form_hash, java.util.Hashtable steam_vars, java.lang.String[] url_tokens, java.lang.String request_uri, long bstamp_id, Response resp, java.sql.Connection conn, Session session, java.util.Hashtable attributes)
          This gets called on every request by the loco, once it determines it has a handler in its hands.
 
Methods inherited from class org.locomotive.server.ServiceRoutingTable
addService, containsService, getProperties, getService, initialize, log, markServiceForReloading, reloadService, routeToClass, routeToService, routeToServiceEntry, shutdown, throwException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server_log

protected Log server_log
Constructor Detail

HandlerRoutingTable

public HandlerRoutingTable(java.lang.String path,
                           Log log,
                           java.util.Vector classpath,
                           boolean auto_reload)
creates a new (but uninitialized) HanderManager
Parameters:
path - the path to the table file
log - a server log
Method Detail

createServiceEntry

protected ServiceRoutingTable.ServiceEntry createServiceEntry(java.lang.String pattern,
                                                              java.lang.String classname,
                                                              java.lang.String config_path)
Adds the a HandlerEntry to the service_hash.
Overrides:
createServiceEntry in class ServiceRoutingTable

putInDefaults

protected void putInDefaults()
                      throws InitializationException
Overrides the superclass to put in the default handlers. here's what we put in:
 default      org.locomotive.loco.handler.DefaultHandler
 unknown      org.locomotive.loco.handler.UnknownHandler
 srv          org.locomotive.loco.ServerHandler
 
Overrides:
putInDefaults in class ServiceRoutingTable

routeRequest

public void routeRequest(int request_id,
                         java.net.Socket sock,
                         java.io.InputStream is,
                         java.io.OutputStream os,
                         java.util.Hashtable cgi_envars,
                         java.util.Hashtable form_hash,
                         java.util.Hashtable steam_vars,
                         java.lang.String[] url_tokens,
                         java.lang.String request_uri,
                         long bstamp_id,
                         Response resp,
                         java.sql.Connection conn,
                         Session session,
                         java.util.Hashtable attributes)
This gets called on every request by the loco, once it determines it has a handler in its hands. It sets up everything the handler needs, then sends it on its way.
Overrides:
routeRequest in class ServiceRoutingTable
Parameters:
request_id - the unique id for this request
sock - the socket this request connected on
is - the inputstream from that socket
os - the outputstream from that socket
reply_protocol - the protocol type we received the request from
cgi_envars - the CGI variables passed in with the request
form_hash - the form data, if there was any
url_tokens - a tokenized form of the url
request_uri - the unparsed url tokens
bstamp_id - the browser stamp id that came in from the bstamp cookie for this request
conn - the Database connection for this request
session - the Session object for this request
user - the user for this request