|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.opmath.util.http.HttpServlet
|
+--com.opmath.util.http.HttpLogOnServlet
Provides an abstract class for a servlet that can respond to a log on request.
Servlets of this class have to deal with three distinct outcomes of the log on request:
HttpProtectedServlet, without the requester having first logged
on. In this case, a redirection is made to the original URL.HttpLogonServlet. In this case, the requester is redirected to
an appropriate resource.HttpLogonServlet. In this case, an appropriate response, noting
the unsuccessful log on, is returned.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.
HttpServlet,
HttpSessionServlet,
HttpLogOffServlet,
HttpProtectedServlet, Serialized Form| Fields inherited from class com.opmath.util.http.HttpServlet |
EOL, LOGON_ID, LOGON_TARGET |
| Constructor Summary | |
HttpLogOnServlet()
|
|
| Method Summary | |
void |
doGet(HttpServletRequest req,
HttpServletResponse rsp)
Handles an HTTP GET request. |
protected String |
doGetDispatch(HttpServletRequest req)
Services an HTTP GET request, as handled by the superclass. |
void |
doPost(HttpServletRequest req,
HttpServletResponse rsp)
Handles an HTTP POST request. |
protected String |
doPostDispatch(HttpServletRequest req)
Services an HTTP POST request, as handled by doPost(HttpServletRequest, HttpServletResponse). |
String |
getServletInfo()
Returns a String carrying some information about the servlet. |
protected String |
identifyUser(HttpServletRequest req)
Attempts to authenticate the requester, and authorize the requester's access. |
protected String |
logOnRedirectURI()
Returns the URI of the resource that is targetted where authentication and authorisation are successful, but no other URI is available. |
| Methods inherited from class com.opmath.util.http.HttpServlet |
getIndex, getParamIndex, getValueCount, paramIndices, paramMappings, paramNames, paramValues, registerIndex, registerIndices, report, setConfig, setConfig |
| Methods inherited from class javax.servlet.http.HttpServlet |
|
| 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 |
public HttpLogOnServlet()
| Method Detail |
protected String logOnRedirectURI()
Returns the URI of the resource that is targetted where authentication and authorisation are successful, but no other URI is available.
This method attempts to provide the home URI of the Web application - the
actual URI String returned is "/".
String carrying the default redirection URI.
public final void doGet(HttpServletRequest req,
HttpServletResponse rsp)
throws ServletException,
IOException
Handles an HTTP GET request.
Specified as final to maintain security.
doGet in class HttpServletreq - an HttpServletRequest object
that contains the request the client has made of the servlet.rsp - an HttpServletResponse object that
contains the response the servlet sends to the client.ServletException - an exception thrown if the request
could not be handled.IOException - an exception thrown if an input or output
error is detected when the servlet handles the GET request.doGetDispatch(com.opmath.util.http.HttpServletRequest)
protected String doGetDispatch(HttpServletRequest req)
throws Exception
Services an HTTP GET request, as handled by the superclass. This method is normally invoked when a GET request is made directly to the implementing servlet.
doGetDispatch in class HttpServletreq - an com.opmath.util.http.HttpServletRequest
created by doGet(HttpServletRequest, HttpServletResponse).String carrying the report.Exception - if a subclass's method encounters any error state.HttpServlet.doGet(HttpServletRequest, HttpServletResponse)
public final void doPost(HttpServletRequest req,
HttpServletResponse rsp)
throws ServletException,
IOException
Handles an HTTP POST request.
As with the doPost(HttpServletRequest, HttpServletResponse) method
on its superclass, the idea here is to do any essential preparatory work, then
hand over control to the doPostDispatch(HttpServletRequest, HttpServletResponse)
method of the subclass. Once the subclass's
doPostDispatch(HttpServletRequest, HttpServletResponse)method has
completed, any essantial cleaning up is done.
Specifically in this case, an attempt is made to authenticate and authorize the user
by invoking the identifyUser(com.opmath.util.http.HttpServletRequest) method
on the actual class of the LogOn Servlet.
If authentication and authoriztion are successful, a redirection takes place. Otherwise,
doPostDispatch(com.opmath.util.http.HttpServletRequest) is executed.
doPost in class HttpServletreq - a javax.servlet.http.HttpServletRequest
carrying the request environmental variables.rsp - a javax.servlet.http.HttpServletResponse
carrying the response objects.ServletException - if the method encounters any method-internal error.IOException - if one of the method's resources could not be used.doPostDispatch(com.opmath.util.http.HttpServletRequest)
protected String doPostDispatch(HttpServletRequest req)
throws Exception
Services an HTTP POST request, as handled by
doPost(HttpServletRequest, HttpServletResponse).
In parctice, this method will only be invoked when a redirection could not take place - that is, when either authenication failed, or authorization was declined. This method should be overriden by any real-world application.
doPostDispatch in class HttpServletreq - an com.opmath.util.http.HttpServletRequest
created by doPost(HttpServletRequest, HttpServletResponse).String carrying the report.Exception - if a subclass's method encounters any error state.doPost(HttpServletRequest, HttpServletResponse)protected String identifyUser(HttpServletRequest req)
Attempts to authenticate the requester, and authorize the requester's access.
If authorized, this method should return a unique ID of the requester. If not
authorized, this method should reurn null.
This method always returns null - in other words, access is
always denied. The method should be overriden by any real-world application.
req - a com.opmath.util.http.HttpServletRequest.String uniquely identifying the requester, or null.public String getServletInfo()
String carrying some information about the servlet. This method should be
overridden by any subclass.
getServletInfo in class HttpServletString describing the class.
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||