com.niggle.servlet
Class NiggleServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.niggle.servlet.NiggleServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class NiggleServlet
extends javax.servlet.http.HttpServlet

The base Servlet class in the Niggle framework. A Niggle-based Servlet will either be an instance of this class or of a subclass. Note that this class defines very little functionality. NiggleServlet delegates to 2 objects, NiggleConfig and ServletInteraction

Author:
Jonathan Revusky
See Also:
NiggleConfig, ServletInteraction, Serialized Form

Field Summary
protected  NiggleConfig niggleConfig
          The object that contains our servlet config info.
 
Constructor Summary
NiggleServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          By default, a Niggle servlet treats a GET and a POST identically.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method implements the top-level flow of of control by which we handle a request.
 java.lang.String getServletInfo()
           
protected  void handleException(javax.servlet.http.HttpServletResponse response, java.lang.Exception e)
          redefine this method in a subclass if you want to throw in some extra default handling.
 void init(javax.servlet.ServletConfig config)
          Servlet initialization.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

niggleConfig

protected NiggleConfig niggleConfig
The object that contains our servlet config info.
Constructor Detail

NiggleServlet

public NiggleServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Servlet initialization. This routine just hands off to the NiggleConfig object that really takes care of initializing the framework.
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - thown if there is some problem initializing this servlet. Servlet will not be loaded.
See Also:
NiggleConfig

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
By default, a Niggle servlet treats a GET and a POST identically. So this method, in this base class, simply invokes doPost()
Overrides:
doGet in class javax.servlet.http.HttpServlet
See Also:
doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
This method implements the top-level flow of of control by which we handle a request. Essentially, we create a ServletInteraction object of the appropriate type (we rely on the niggleConfig object to do this.) Then we invoke the dispatch() method which carries out the logic implicit in the request. At the end, we invoke interaction.output() in order to output a page as a result of the request.
Overrides:
doPost in class javax.servlet.http.HttpServlet

getServletInfo

public java.lang.String getServletInfo()
Overrides:
getServletInfo in class javax.servlet.GenericServlet

handleException

protected void handleException(javax.servlet.http.HttpServletResponse response,
                               java.lang.Exception e)
                        throws java.io.IOException,
                               javax.servlet.ServletException
redefine this method in a subclass if you want to throw in some extra default handling. (For example, our in-house apps actually email the stack traces to our dev and qa aliases.) The default implementation here simply rethrows the exception and it bubbles up to the handler at the next level (the servlet server) which does whatever it does by default.