OpMath

com.opmath.util.http
Class HttpSessionServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.opmath.util.http.HttpServlet
                    |
                    +--com.opmath.util.http.HttpSessionServlet
All Implemented Interfaces:
ParamIndex, Serializable, Servlet, ServletConfig

public abstract class HttpSessionServlet
extends HttpServlet
implements ParamIndex

Provides an abstract class for a session servlet.

The structure and functionality of this class is identical to its superclass, with the difference that it makes use of the HttpSession instance valiable, and instantiates this variable before calling doGetDispatch(HttpServletRequest) or doPostDispatch(HttpServletRequest).

NOTE: Application servlets that require protected or log on functionality for their sessions should subclass com.opmath.util.http.HttpProtectedServlet, and not this class.

WARNING: It is up to the programmer to ensure that the use of the HttpSession instance variable (or any other instance variable) has thread safety.

Copyright: (c) 2002 The Open Math Company Limited

The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.

Since:
J2SE 1.3.0
Version:
utilities-v011
Author:
Bruno Beloff bruno.beloff@opmath.com
See Also:
HttpServlet, HttpLogOnServlet, HttpLogOffServlet, HttpProtectedServlet, Serialized Form

Fields inherited from class com.opmath.util.http.HttpServlet
EOL, LOGON_ID, LOGON_TARGET
 
Constructor Summary
HttpSessionServlet()
           
 
Method Summary
 void doGet(HttpServletRequest req, HttpServletResponse rsp)
          Handles an HTTP GET request.
protected  String doGetDispatch(HttpServletRequest req, HttpSession session)
          Services an HTTP GET request, as caught by the doGet(HttpServletRequest, HttpServletResponse) method on this class.
 void doPost(HttpServletRequest req, HttpServletResponse rsp)
          Handles an HTTP POST request.
protected  String doPostDispatch(HttpServletRequest req, HttpSession session)
          Services an HTTP POST request, as caught by the doPost(HttpServletRequest, HttpServletResponse) method on this class.
 String getServletInfo()
          Returns a String carrying some information about the servlet.
 
Methods inherited from class com.opmath.util.http.HttpServlet
doGetDispatch, doPostDispatch, getIndex, getParamIndex, getValueCount, paramIndices, paramMappings, paramNames, paramValues, registerIndex, registerIndices, report, setConfig, setConfig
 
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, getServletName, init, 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 com.opmath.util.http.ParamIndex
getIndex, getParamIndex, getValueCount, paramIndices, paramMappings, paramNames, paramValues, registerIndex
 

Constructor Detail

HttpSessionServlet

public HttpSessionServlet()
Method Detail

doGet

public void doGet(HttpServletRequest req,
                  HttpServletResponse rsp)
           throws ServletException,
                  IOException

Handles an HTTP GET request. This method instantiates the session object of the servlet, then arranges that the doGetDispatch(com.opmath.util.http.HttpServletRequest, HttpSession session) method is invoked.

Overrides:
doGet in class HttpServlet
Parameters:
req - a javax.servlet.http.HttpServletRequest carrying the request environmental variables.
rsp - a javax.servlet.http.HttpServletResponse carrying the response objects.
Throws:
ServletException - if the method encounters any method-internal error.
IOException - if one of the method's resources could not be used.
Since:
J2SE 1.3
See Also:
doGetDispatch(com.opmath.util.http.HttpServletRequest, HttpSession session)

doGetDispatch

protected String doGetDispatch(HttpServletRequest req,
                               HttpSession session)
                        throws Exception

Services an HTTP GET request, as caught by the doGet(HttpServletRequest, HttpServletResponse) method on this class. This method should be overriden by any real-world application.

Parameters:
req - an com.opmath.util.http.HttpServletRequest created by doGet(HttpServletRequest, HttpServletResponse).
session - a HttpSession carrying the session.
Returns:
A String carrying the report.
Throws:
Exception - if a subclass's method encounters any error state.
Since:
J2SE 1.3
See Also:
doGet(HttpServletRequest, HttpServletResponse)

doPost

public void doPost(HttpServletRequest req,
                   HttpServletResponse rsp)
            throws ServletException,
                   IOException

Handles an HTTP POST request. This method instantiates the session object of the servlet, then arranges that the doPostDispatch(com.opmath.util.http.HttpServletRequest, HttpSession session) method is invoked.

Overrides:
doPost in class HttpServlet
Parameters:
req - a javax.servlet.http.HttpServletRequest carrying the request environmental variables.
rsp - a javax.servlet.http.HttpServletResponse carrying the response objects.
Throws:
ServletException - if the method encounters any method-internal error.
IOException - if one of the method's resources could not be used.
Since:
J2SE 1.3
See Also:
doPostDispatch(com.opmath.util.http.HttpServletRequest, HttpSession session)

doPostDispatch

protected String doPostDispatch(HttpServletRequest req,
                                HttpSession session)
                         throws Exception

Services an HTTP POST request, as caught by the doPost(HttpServletRequest, HttpServletResponse) method on this class. This method should be overriden by any real-world application.

Parameters:
req - an com.opmath.util.http.HttpServletRequest created by doGet(HttpServletRequest, HttpServletResponse).
session - a HttpSession carrying the session.
Returns:
A String carrying the report.
Throws:
Exception - if a subclass's method encounters any error state.
Since:
J2SE 1.3
See Also:
doPost(HttpServletRequest, HttpServletResponse)

getServletInfo

public String getServletInfo()
Returns a String carrying some information about the servlet. This method should be overridden by any subclass.

Overrides:
getServletInfo in class HttpServlet
Returns:
a String describing the class.
Since:
J2SE 1.3

OpMath

Submit a bug or feature to Open Math
Copyright © 2002 Open Math Company Limited, Brighton, UK