com.digitalsanctuary.atg.captcha
Class CaptchaFormHandler

java.lang.Object
  extended byatg.nucleus.GenericService
      extended byatg.droplet.EmptyFormHandler
          extended byatg.droplet.GenericFormHandler
              extended bycom.digitalsanctuary.atg.captcha.CaptchaFormHandler
All Implemented Interfaces:
atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.droplet.DropletFormHandler, java.util.EventListener, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener

public class CaptchaFormHandler
extends atg.droplet.GenericFormHandler

Handles validation of user input against captcha input. Depends on simplecaptcha image generation. If simplecaptcha value is not found in session user passes validation.

Handlers:
handleSubmit

Author:
Robert Ostronic rostronic@gmail.com, Devon Hillard (devon@digitalsanctuary.com)

Field Summary
static java.lang.String PROFILE_CAPTCHA_VALIDATED
          The captcha validated profile property.
static java.lang.String SESSION_CAPTCHA_PROPERTY
          Session parameter name where captcha text is placed in session by SimpleCaptcha.
 
Fields inherited from class atg.droplet.GenericFormHandler
CLASS_VERSION, PARAM_USE_FORWARDS
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
CaptchaFormHandler()
           
 
Method Summary
 java.lang.String getCaptcha()
           
 java.lang.String getErrorURL()
           
 atg.userprofiling.Profile getProfile()
           
 java.lang.String getSuccessURL()
           
 boolean handleSubmit(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          This method handles the submission of a captcha answer.
 void postValidationAction()
          When this class is sub-typed, this method should be overridden to perform any actions upon the user entering the correct captcha.
 void setCaptcha(java.lang.String pCaptcha)
           
 void setErrorURL(java.lang.String pErrorURL)
           
 void setProfile(atg.userprofiling.Profile pProfile)
           
 void setSuccessURL(java.lang.String pSuccessURL)
           
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, handleCancel, handleFormException, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingWarning, setServiceInfo, startService, stopService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_CAPTCHA_VALIDATED

public static final java.lang.String PROFILE_CAPTCHA_VALIDATED
The captcha validated profile property.

See Also:
Constant Field Values

SESSION_CAPTCHA_PROPERTY

public static final java.lang.String SESSION_CAPTCHA_PROPERTY
Session parameter name where captcha text is placed in session by SimpleCaptcha.

See Also:
Constant Field Values
Constructor Detail

CaptchaFormHandler

public CaptchaFormHandler()
Method Detail

handleSubmit

public boolean handleSubmit(atg.servlet.DynamoHttpServletRequest pRequest,
                            atg.servlet.DynamoHttpServletResponse pResponse)
                     throws java.io.IOException,
                            javax.servlet.ServletException
This method handles the submission of a captcha answer.

Parameters:
pRequest - the dynamo request object.
pResponse - the dynamo response object.
Returns:
true if page should render normally.
Throws:
java.io.IOException - on error.
javax.servlet.ServletException - on error.

postValidationAction

public void postValidationAction()
When this class is sub-typed, this method should be overridden to perform any actions upon the user entering the correct captcha. For instance setting a profile attribute or a property on a session scoped component.


getSuccessURL

public java.lang.String getSuccessURL()
Returns:
the successURL.

setSuccessURL

public void setSuccessURL(java.lang.String pSuccessURL)
Parameters:
pSuccessURL - the url to redirect to in a success case.

getErrorURL

public java.lang.String getErrorURL()
Returns:
the error URL.

setErrorURL

public void setErrorURL(java.lang.String pErrorURL)
Parameters:
pErrorURL - the url to redirect to in an error case.

getCaptcha

public java.lang.String getCaptcha()
Returns:
the captcha

setCaptcha

public void setCaptcha(java.lang.String pCaptcha)
Parameters:
pCaptcha - the captcha to set

getProfile

public atg.userprofiling.Profile getProfile()
Returns:
the profile

setProfile

public void setProfile(atg.userprofiling.Profile pProfile)
Parameters:
pProfile - the profile to set