org.locomotive.loco
Class HTTPServer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.locomotive.loco.HTTPServer

public class HTTPServer
extends java.lang.Thread

The org.locomotive.loco.HTTPServer is the Locomotive's embedded web server. The server instances are launched by the org.locomotive.loco.Loco object on startup.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 Log getAccessLog()
          gets the reference to the access log of this HTTPServer instance
 int getActiveThreadCount()
          Returns the number of active RequestManager Threads.
static boolean getAutoSessionHandling()
          returns the current value of the auto_session_handling flag.
 HTTPServerConfig getConfig()
          returns the HTTPServerConfig of the server
 int getCurrentRequestID()
          gets the current value of the request id.
 Log getEventLog()
          gets the reference to the event log of this HTTPServer instance
 int getMaxThreadPoolSize()
          Returns the number of active RequestManager Threads.
 Log getServerLog()
          gets the reference to the main server log of this HTTPServer instance
 java.util.Date getStartupDate()
          returns the startup date of the HTTPServer
 int getThreadPoolSize()
          Returns the number of active RequestManager Threads.
 java.lang.String getVersionString()
          returns the Version Number of the server (for now, returns the same String as Loco.getVersionString();
 void log(int lev, java.lang.String s)
          log to the HTTPServer log
 void logAccess(java.lang.String client_host, java.lang.String remote_username, java.lang.String authenticated_username, java.lang.String request_line, int response_status, int response_length)
          Log a request to the HTTPServer access log

 void logEvent(int level, int rid, Session sess, User u, java.lang.String major, java.lang.String minor, java.lang.String data)
          log to the HTTPServer event log
 void run()
          This method is called by the Loco Object
 void setStopAccepting()
          for shutting down the HTTPServer.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

run

public void run()
This method is called by the Loco Object
Overrides:
run in class java.lang.Thread

log

public void log(int lev,
                java.lang.String s)
log to the HTTPServer log
Parameters:
lev - the log level
s - a string to be logged

logEvent

public void logEvent(int level,
                     int rid,
                     Session sess,
                     User u,
                     java.lang.String major,
                     java.lang.String minor,
                     java.lang.String data)
log to the HTTPServer event log
Parameters:
level - - the log level
rid - - the response id (used mostly for debugging)
sess - - the current session
u - - the User
major - - the major event region or code section
minor - - the minor event code
data - - event specific data

logAccess

public void logAccess(java.lang.String client_host,
                      java.lang.String remote_username,
                      java.lang.String authenticated_username,
                      java.lang.String request_line,
                      int response_status,
                      int response_length)
Log a request to the HTTPServer access log

Parameters:
client_host - The client's IP address (for now)
remote_username - The rfc931 username of the user at the client
authenticated_username - The authenticated username as specified by rfc931
request_line - The request line exactly as it came from the client
response_status - The numeric HTTP status code returned to the client
response_length - The number of bytes of the response body that was sent to the client

getServerLog

public Log getServerLog()
gets the reference to the main server log of this HTTPServer instance

getEventLog

public Log getEventLog()
gets the reference to the event log of this HTTPServer instance

getAccessLog

public Log getAccessLog()
gets the reference to the access log of this HTTPServer instance

getActiveThreadCount

public int getActiveThreadCount()
Returns the number of active RequestManager Threads. Allows you to get and idea of current load/concurrency.

getThreadPoolSize

public int getThreadPoolSize()
Returns the number of active RequestManager Threads. Allows you to get and idea of current load/concurrency.

getMaxThreadPoolSize

public int getMaxThreadPoolSize()
Returns the number of active RequestManager Threads. Allows you to get and idea of current load/concurrency.

getStartupDate

public java.util.Date getStartupDate()
returns the startup date of the HTTPServer

getCurrentRequestID

public int getCurrentRequestID()
gets the current value of the request id. The value is incremented just before pulling a new client off the queue.

getAutoSessionHandling

public static boolean getAutoSessionHandling()
returns the current value of the auto_session_handling flag.
See Also:
setAutoSessionHandling

setStopAccepting

public void setStopAccepting()
for shutting down the HTTPServer. After handling the next inbound connection, the Loco will stop accepting new connections, do various cleanups, then exit

getConfig

public HTTPServerConfig getConfig()
returns the HTTPServerConfig of the server

getVersionString

public java.lang.String getVersionString()
returns the Version Number of the server (for now, returns the same String as Loco.getVersionString();