public class EmailFormHandler extends GenericFormHandler
A typical form would look like this:
SMTPEmailSender| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CLASS_VERSION  | 
protected static java.lang.String | 
MSG_EMPTY_MESSAGE  | 
protected static java.lang.String | 
MSG_INVALID_RECIPIENT_EMAIL  | 
protected static java.lang.String | 
MSG_INVALID_SENDER_EMAIL  | 
protected static java.lang.String | 
MSG_NO_EMAIL_HOST_NAME  | 
protected static java.lang.String | 
MSG_NO_RECIPIENT_EMAIL  | 
protected static java.lang.String | 
MSG_NO_SENDER_EMAIL  | 
static java.lang.String | 
RESOURCE_BUNDLE
Resource bundle that holds messages to dispay to the end user 
 | 
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDSSERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
EmailFormHandler()
Constructs an EmailFormHandler object. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.String | 
getBody()
Returns property body. 
 | 
java.util.Locale | 
getDefaultLocale()
Returns property DefaultLocale. 
 | 
SMTPEmailSender | 
getEmailSenderService()
Returns property emailSenderService. 
 | 
java.lang.String | 
getRecipient()
Returns property recipient. 
 | 
java.lang.String | 
getSender()
Returns property sender. 
 | 
java.lang.String | 
getSendErrorURL()
Returns property sendErrorURL 
 | 
java.lang.String | 
getSendSuccessURL()
Returns property sendSuccessURL. 
 | 
java.lang.String | 
getSubject()
Returns property subject. 
 | 
java.util.Locale | 
getUserLocale(DynamoHttpServletRequest pRequest,
             DynamoHttpServletResponse pResponse)
Returns the locale associated with the request. 
 | 
boolean | 
handleSendEmail(DynamoHttpServletRequest pRequest,
               DynamoHttpServletResponse pResponse)
This method is typically associated with the form's submit button. 
 | 
boolean | 
isUseRequestLocale()
Returns property UseRequestLocale 
 | 
protected boolean | 
sendMail(DynamoHttpServletRequest pRequest,
        DynamoHttpServletResponse pResponse)
Perform the actual send operation. 
 | 
void | 
setBody(java.lang.String pBody)
Sets property body, the content of the email. 
 | 
void | 
setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale for localizing user messages 
 | 
void | 
setEmailSenderService(SMTPEmailSender pEmailSender)
Sets property emailSenderService, wich will be used to send the email. 
 | 
void | 
setRecipient(java.lang.String pRecipient)
Sets property recipient, used as the To: tag of the email. 
 | 
void | 
setSender(java.lang.String pSender)
Sets property sender, used as the From: tag of the email. 
 | 
void | 
setSendErrorURL(java.lang.String pSendErrorURL)
Sets property sendErrorURL, identifying the page this method
 will redirect to if there is an error sending the email. 
 | 
void | 
setSendSuccessURL(java.lang.String pSendSuccessURL)
Sets property sendSuccessURL, identifying the page this method
 will redirect to if the email is successfully sent. 
 | 
void | 
setSubject(java.lang.String pSubject)
Sets property subject, used as the Subject: tag of the email. 
 | 
void | 
setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale which determines whether to use
 the requestLocale for localizing user messages 
 | 
java.lang.String | 
toString()
Return a toString that includes the name of the component, if
 available. 
 | 
protected boolean | 
validate(DynamoHttpServletRequest pRequest,
        DynamoHttpServletResponse pResponse)
Validate the email's fields for correctness. 
 | 
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwardsafterGet, beforeGetaddLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static final java.lang.String CLASS_VERSION
public static java.lang.String RESOURCE_BUNDLE
protected static final java.lang.String MSG_NO_SENDER_EMAIL
protected static final java.lang.String MSG_INVALID_SENDER_EMAIL
protected static final java.lang.String MSG_NO_RECIPIENT_EMAIL
protected static final java.lang.String MSG_INVALID_RECIPIENT_EMAIL
protected static final java.lang.String MSG_EMPTY_MESSAGE
protected static final java.lang.String MSG_NO_EMAIL_HOST_NAME
public EmailFormHandler()
public void setEmailSenderService(SMTPEmailSender pEmailSender)
public SMTPEmailSender getEmailSenderService()
public void setSendSuccessURL(java.lang.String pSendSuccessURL)
public java.lang.String getSendSuccessURL()
public void setSendErrorURL(java.lang.String pSendErrorURL)
public java.lang.String getSendErrorURL()
public void setSender(java.lang.String pSender)
public java.lang.String getSender()
public void setRecipient(java.lang.String pRecipient)
public java.lang.String getRecipient()
public void setSubject(java.lang.String pSubject)
public java.lang.String getSubject()
public void setBody(java.lang.String pBody)
public java.lang.String getBody()
public void setDefaultLocale(java.util.Locale pDefaultLocale)
public java.util.Locale getDefaultLocale()
public void setUseRequestLocale(boolean pUseRequestLocale)
public boolean isUseRequestLocale()
protected boolean sendMail(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionprotected boolean validate(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
 Currently only checks that the sender and recipient addresses
 contain a '@' and that both the subject andd body aren't empty.
 
 This protected method is intended to be overriden by a subclass
 to provide customized error checking.
javax.servlet.ServletExceptionjava.io.IOExceptionpublic boolean handleSendEmail(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
sendSuccessURL property, if this property is set. If the email 
 is not sent, it redirects the user to the url identified by the
 sendErrorURL property, if this property is set.
 The sending operation is broken down into three steps:
validate() method
 sendMail() method
 handleSendEmail() handler
 sendMail() and validate() methods are protected methods that developers
 are encouraged to override in a derived class to perform customized error checking
 or to modify the email tags prior to sending the email.
 pRequest - the request to be processedpResponse - the response object for this requestjava.io.IOExceptionjavax.servlet.ServletExceptionpublic java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
locale. This value can be
 either a java.util.Locale object or a String which represents the locale.
 Next if the useRequestLocale property is true, then the locale
 of the request will be returned. Finally, if the locale cannot be determined,
 the the defaultLocale property is used.javax.servlet.ServletExceptionjava.io.IOExceptionpublic java.lang.String toString()
GenericServicetoString in class GenericService