org.liquidsite.app.servlet
Class LiquidSiteServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.liquidsite.app.servlet.LiquidSiteServlet
All Implemented Interfaces:
Application, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class LiquidSiteServlet
extends javax.servlet.http.HttpServlet
implements Application

A front controller servlet. This class handles all incoming HTTP requests.

See Also:
Serialized Form

Field Summary
protected static Log LOG
          The class logger.
 
Constructor Summary
LiquidSiteServlet()
           
 
Method Summary
 void destroy()
          Uninitializes this servlet.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles an incoming HTTP GET request.
protected  void doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles an incoming HTTP HEAD request.
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles an incoming HTTP POST request.
 java.io.File getBaseDir()
          Returns the base application directory.
 java.lang.String getBuildDate()
          Returns the application build date.
 java.lang.String getBuildVersion()
          Returns the application build version number.
 Configuration getConfig()
          Returns the application configuration.
 ContentManager getContentManager()
          Returns the application content manager.
 DatabaseConnector getDatabase()
          Returns the application database connector.
 void init()
          Initializes this servlet.
 boolean isOnline()
          Checks if the application is running correctly.
 void restart()
          Restarts the application.
 void shutdown()
          Shuts down the application.
 void startup()
          Starts up the application.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.liquidsite.app.servlet.Application
getServletContext
 

Field Detail

LOG

protected static final Log LOG
The class logger.

Constructor Detail

LiquidSiteServlet

public LiquidSiteServlet()
Method Detail

isOnline

public boolean isOnline()
Checks if the application is running correctly. This method will return true if no major errors have been encountered, such as database connections are not working or similar. Note that this method may return true even if the application is not installed, assuming that the installed has been properly launched.

Specified by:
isOnline in interface Application
Returns:
true if the application is online and working, or false otherwise

init

public void init()
Initializes this servlet.


destroy

public void destroy()
Uninitializes this servlet.

Specified by:
destroy in interface javax.servlet.Servlet

startup

public void startup()
Starts up the application. This will initialize the configuration, the database, and the relevant request processor.


shutdown

public void shutdown()
Shuts down the application. This will deinitialize the request processor and the database connector.


restart

public void restart()
Restarts the application. This will perform a partial shutdown followed by a startup, flushing and rereading all datastructures, such as configuration, database connections, and similar.

Specified by:
restart in interface Application

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Handles an incoming HTTP GET request.

Parameters:
request - the HTTP request object
response - the HTTP response object
Throws:
javax.servlet.ServletException - if the request couldn't be handled by this servlet
java.io.IOException - if an IO error occured while attempting to service this request

doHead

protected void doHead(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
Handles an incoming HTTP HEAD request.

Parameters:
request - the HTTP request object
response - the HTTP response object
Throws:
javax.servlet.ServletException - if the request couldn't be handled by this servlet
java.io.IOException - if an IO error occured while attempting to service this request

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
Handles an incoming HTTP POST request.

Parameters:
request - the HTTP request object
response - the HTTP response object
Throws:
javax.servlet.ServletException - if the request couldn't be handled by this servlet
java.io.IOException - if an IO error occured while attempting to service this request

getBuildVersion

public java.lang.String getBuildVersion()
Returns the application build version number.

Specified by:
getBuildVersion in interface Application
Returns:
the application build version number

getBuildDate

public java.lang.String getBuildDate()
Returns the application build date.

Specified by:
getBuildDate in interface Application
Returns:
the application build date

getBaseDir

public java.io.File getBaseDir()
Returns the base application directory. This is the directory containing all the application files (i.e. the corresponding webapps directory).

Specified by:
getBaseDir in interface Application
Returns:
the base application directory

getConfig

public Configuration getConfig()
Returns the application configuration. The object returned by this method will not change, unless a reset is made, but the parameter values in the configuration may be modified.

Specified by:
getConfig in interface Application
Returns:
the application configuration

getDatabase

public DatabaseConnector getDatabase()
Returns the application database connector. The object returned by this method will not change, unless a reset is made.

Specified by:
getDatabase in interface Application
Returns:
the application database connector

getContentManager

public ContentManager getContentManager()
Returns the application content manager. The object returned by this method will not change, unless a reset is made.

Specified by:
getContentManager in interface Application
Returns:
the application content manager