edu.utexas.its.eis.tools.qwicap.servlet
Class QwicapServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by edu.utexas.its.eis.tools.qwicap.servlet.QwicapServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class QwicapServlet
extends HttpServlet

QwicapServlet is the servlet on which Qwicap (Quick Web Interface for Conventional Applications) is built. Qwicap client code runs in a QwicapThread which interacts with this servlet to get input from users and send output to them. The client code never has to concern itself with this, or any other servlet, except in as much as it might want to use the GenericServlet.getServletConfig() method to get information about the servlet environment in which it is operating.

Author:
Chris W. Johnson
See Also:
Serialized Form

Constructor Summary
QwicapServlet()
           
 
Method Summary
 void destroy()
           
protected  void doGet(HttpServletRequest Req, HttpServletResponse Resp)
           
protected  void doHead(HttpServletRequest Req, HttpServletResponse Resp)
           
protected  void doPost(HttpServletRequest Req, HttpServletResponse Resp)
           
 void init()
          Initializes QwicapServlet by invoking init(Class, Auth2SchemeFactory), and passing null for both parameters.
 void init(Class<?> ClientClassSuggestion, Auth2SchemeFactory A2SFactorySuggestion)
          Initializes the QwicapServlet.
 String toString()
           
 
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, wait, wait, wait
 

Constructor Detail

QwicapServlet

public QwicapServlet()
Method Detail

init

public void init()

Initializes QwicapServlet by invoking init(Class, Auth2SchemeFactory), and passing null for both parameters. If you wish to change the manner in which Qwicap discovers your web application's Auth2SchemeFactory, or client class (the class that contains the "public static void main(String[] args)" method where Qwicap should begin executing your web application), you may create a subclass of QwicapServlet, override this method, and pass whatever you wish to the init(Class, Auth2SchemeFactory) method. In order to make Qwicap use your subclass, you'll need to change the web application deployment descriptor ("web.xml" file) such that the tag "<servlet-class>edu.utexas.its.eis.tools.qwicap.servlet.QwicapServlet</servlet-class>" specifies your subclass.

Note: Creating your own subclass of QwicapServlet to override init is also useful when Qwicap is installed as a shared library, for example in Tomcat's "shared/lib" subdirectory. In such cases, the classes for your web application are typically in a class loader that is a "child" of the shared library class loader. Because class loaders only delegate to their parents, and never to their children, your web application's classes cannot be loaded by code in the shared libraries. However, by overriding init() with your own implementation that instantiates your Auth2SchemeFactory (if any), and supplies a reference to the class that contains your application's entry point (a "public static void main(String[] args)" method), you can avoid those class loader issues.

Overrides:
init in class GenericServlet
See Also:
init(Class, Auth2SchemeFactory)

init

public final void init(Class<?> ClientClassSuggestion,
                       Auth2SchemeFactory A2SFactorySuggestion)
Initializes the QwicapServlet. This method is invoked by the init() method.

Parameters:
ClientClassSuggestion - A reference to the class that implements your web application's entry point (a "public static void main(String[] args)" method), or null if Qwicap should use the class specified by the web application deployment descriptor ("web.xml" file).
A2SFactorySuggestion - An instance of a class implementing the Auth2SchemeFactory interface, or null if Qwicap should use the factory class specified by the web application deployment descriptor ("web.xml" file). If null is passed, and there is no such specification in the deployment descriptor, Qwicap will perform no authentication, or authorization for your application.

destroy

public void destroy()
Specified by:
destroy in interface Servlet
Overrides:
destroy in class GenericServlet

doHead

protected void doHead(HttpServletRequest Req,
                      HttpServletResponse Resp)
               throws ServletException,
                      IOException
Overrides:
doHead in class HttpServlet
Throws:
ServletException
IOException

doGet

protected void doGet(HttpServletRequest Req,
                     HttpServletResponse Resp)
              throws ServletException,
                     IOException
Overrides:
doGet in class HttpServlet
Throws:
ServletException
IOException

doPost

protected void doPost(HttpServletRequest Req,
                      HttpServletResponse Resp)
               throws ServletException,
                      IOException
Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException

toString

public String toString()
Overrides:
toString in class Object