Package nl.captcha.servlet
Class StickyCaptchaServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
nl.captcha.servlet.SimpleCaptchaServlet
nl.captcha.servlet.StickyCaptchaServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
Builds a 200x50 (default) CAPTCHA and attaches it to the session. This is intended to help prevent
bots from simply reloading the page and getting new images until one is
generated which they can successfully parse. Removal of the session attribute
CaptchaServletUtil.NAME will force a new Captcha
to be added to the session.
Image height and width may be customized by adding the "heigh" and "width" init-params to web.xml. For example:
<servlet>
<servlet-name>StickyCaptcha</servlet-name>
<servlet-class>nl.captcha.servlet.StickyCaptchaServlet</servlet-class>
<init-param>
<param-name>width</param-name>
<param-value>250</param-value>
</init-param>
<init-param>
<param-name>height</param-name>
<param-value>75</param-value>
</init-param>
</servlet>
- Author:
- James Childers
- See Also:
-
Field Summary
Fields inherited from class nl.captcha.servlet.SimpleCaptchaServlet
_height, _widthFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Write out the CAPTCHA image stored in the session.Methods inherited from class nl.captcha.servlet.SimpleCaptchaServlet
initMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
-
Constructor Details
-
StickyCaptchaServlet
public StickyCaptchaServlet()
-
-
Method Details
-
doGet
public void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Write out the CAPTCHA image stored in the session. If not present, generate a new <code>Captcha</code> and write out its image.- Overrides:
doGetin classSimpleCaptchaServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-