cmu.jspsurveymanager
Class Controller

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by cmu.jspsurveymanager.Controller
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Controller
extends javax.servlet.http.HttpServlet

Main servlet class performs the controller dispatch function. Developed by Peter Centgraf as final project for the CMU 15-397: Web Application Development course, Spring 2004.

See Also:
Serialized Form

Nested Class Summary
 class Controller.SessionParameters
           
 
Constructor Summary
Controller()
           
 
Method Summary
 boolean canGetTomcatManager(java.lang.String path, Controller.SessionParameters state)
           
 void dispatchTo(java.lang.String file, Controller.SessionParameters state)
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when someone accesses the servlet.
 void doHomePage(Controller.SessionParameters state)
           
 void doLoginPage(Controller.SessionParameters state)
           
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called when someone accesses the servlet.
 java.lang.String getDatabaseHostName(Controller.SessionParameters state)
           
 javax.servlet.ServletConfig getServletConfig()
          Overrides and implements the Servlet.getConfig() method.
 TomcatManagerConnection getTomcatManager(Controller.SessionParameters state)
           
 void init(javax.servlet.ServletConfig config)
          Initializes the databases (if necessary) for this application.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
Initializes the databases (if necessary) for this application.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Overrides and implements the Servlet.getConfig() method.

Specified by:
getServletConfig in interface javax.servlet.Servlet
Overrides:
getServletConfig in class javax.servlet.GenericServlet

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
Called when someone accesses the servlet.

Overrides:
doGet in class javax.servlet.http.HttpServlet

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
Called when someone accesses the servlet.

Overrides:
doPost in class javax.servlet.http.HttpServlet

dispatchTo

public void dispatchTo(java.lang.String file,
                       Controller.SessionParameters state)
                throws java.io.IOException,
                       javax.servlet.ServletException
Throws:
java.io.IOException
javax.servlet.ServletException

doHomePage

public void doHomePage(Controller.SessionParameters state)
                throws javax.servlet.ServletException,
                       java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

doLoginPage

public void doLoginPage(Controller.SessionParameters state)
                 throws javax.servlet.ServletException,
                        java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

getDatabaseHostName

public java.lang.String getDatabaseHostName(Controller.SessionParameters state)
                                     throws java.net.UnknownHostException
Returns:
Throws:
java.net.UnknownHostException

canGetTomcatManager

public boolean canGetTomcatManager(java.lang.String path,
                                   Controller.SessionParameters state)
                            throws java.io.IOException,
                                   javax.servlet.ServletException
Throws:
java.io.IOException
javax.servlet.ServletException

getTomcatManager

public TomcatManagerConnection getTomcatManager(Controller.SessionParameters state)
                                         throws java.lang.Exception
Returns:
either a TomcatManagerConnection or a Exception, depending upon whether it worked or not
Throws:
java.lang.Exception