com.darwinsys.servlet
Class HumanResponseServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.darwinsys.servlet.HumanResponseServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class HumanResponseServlet
- extends javax.servlet.http.HttpServlet
Generate output that requires a human response, that is,
output an image of a string that the user has to read and
type back into a form. The complication is that we can't
generate the image back to the middle of a JSP, so we create
it in a temp file, and write the <IMG> tag back to the user
- See Also:
- Serialized Form
Method Summary |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
void |
init(javax.servlet.ServletConfig arg0)
|
boolean |
isValidString(javax.servlet.http.HttpSession session,
java.lang.String input)
Return true iff the user entered the correct string. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPost, 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 |
SESSION_KEY_RESPONSE
public static final java.lang.String SESSION_KEY_RESPONSE
- See Also:
- Constant Field Values
HumanResponseServlet
public HumanResponseServlet()
init
public void init(javax.servlet.ServletConfig arg0)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class javax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
isValidString
public boolean isValidString(javax.servlet.http.HttpSession session,
java.lang.String input)
- Return true iff the user entered the correct string.
Designed to be called from the target servlet,
just to encapsulate the logic for this all in one place.
- Parameters:
session
- input
-
- Returns:
- True if the user input matches what's in the session.
Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.