Project 3

cscie259.project3.wahoo
Class WahooServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by cscie259.project3.wahoo.WahooServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
Login, Prefs, View

public abstract class WahooServlet
extends javax.servlet.http.HttpServlet

Base class for Wahoo's servlets. You MAY modify this file.

Version:
8.0
Author:
Computer Science E-259, YOUR NAME GOES HERE
See Also:
Serialized Form

Constructor Summary
WahooServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Responds to GETs in the same manner as POSTs.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Responds to POSTs in the same manner as GETs.
protected abstract  void doWork(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          To be implemented by descendants, handles GETs and POSTs identically.
 void forward(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)
          Used to forward the request and response objects to another servlet (whose path is of the form "/servlet/foo") for processing.
 void init()
          Common initialization tasks for this group of servlets.
 void redirect(javax.servlet.http.HttpServletResponse response, java.lang.String url)
          Used to redirect the user to another url (or servlet in the same container), without preserving the current HttpServletRequest object.
 
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, 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
 

Constructor Detail

WahooServlet

public WahooServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
Responds to GETs in the same manner as POSTs.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - HTTP request object
response - HTTP response object
Throws:
java.io.IOException - if an IO-related error occurs
javax.servlet.ServletException - if a servlet-related error occurs

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException,
                   javax.servlet.ServletException
Responds to POSTs in the same manner as GETs.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - HTTP request object
response - HTTP response object
Throws:
java.io.IOException - if an IO-related error occurs
javax.servlet.ServletException - if a servlet-related error occurs

doWork

protected abstract void doWork(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws java.io.IOException,
                               javax.servlet.ServletException
To be implemented by descendants, handles GETs and POSTs identically.

Parameters:
request - HTTP request object
response - HTTP response object
Throws:
java.io.IOException - if an IO-related error occurs
javax.servlet.ServletException - if a servlet-related error occurs

forward

public void forward(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    java.lang.String path)
             throws java.io.IOException,
                    javax.servlet.ServletException
Used to forward the request and response objects to another servlet (whose path is of the form "/servlet/foo") for processing.

Parameters:
request - HTTP request object
response - HTTP response object
path - the path to the servlet being forwarded to
Throws:
java.io.IOException - if an IO-related error occurs
javax.servlet.ServletException - if a servlet-related error occurs

init

public void init()
          throws javax.servlet.ServletException
Common initialization tasks for this group of servlets. Initializes the UserManager instance.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if a servlet-related error occurs

redirect

public void redirect(javax.servlet.http.HttpServletResponse response,
                     java.lang.String url)
              throws java.io.IOException
Used to redirect the user to another url (or servlet in the same container), without preserving the current HttpServletRequest object.

Parameters:
response - HTTP response object
url - the url to which the user's being redirected
Throws:
java.io.IOException - if an IO-related error occurs

Project 3