public class GenericFormHandler extends EmptyFormHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
static java.lang.String |
PARAM_DEFER_FORWARD_OR_REDIRECT
The name of a parameter that represents whether to defer the execution of
forwards and redirects until after all form handling has been completed.
|
static java.lang.String |
PARAM_USE_FORWARDS
The name of a parameter that represents whether to use forwards.
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
GenericFormHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addFormException(DropletException exc)
Adds a new exception to the list of FormExceptions.
|
void |
addUncheckedFormException(java.lang.Throwable exc)
Adds a new exception to the list of FormExceptions.
|
boolean |
afterSet(DynamoHttpServletRequest request,
DynamoHttpServletResponse response)
Clear out the current request we are processing.
|
boolean |
beforeSet(DynamoHttpServletRequest request,
DynamoHttpServletResponse response)
Called before any setX methods on this form are set when a form
that modifies properties of this form handler is submitted.
|
boolean |
checkFormRedirect(java.lang.String pSuccessURL,
java.lang.String pFailureURL,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
If NO form errors are found, redirect to the SuccessURL.
|
java.io.Serializable |
createFormSubmissionMessage(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse) |
java.lang.String |
getCancelURL() |
boolean |
getCheckForValidSession() |
boolean |
getFormError()
Returns true if an error occurred while processing the form.
|
java.util.Vector |
getFormExceptions()
Returns the array of exceptions that occurred for display in the page
|
java.lang.String |
getFormName() |
java.lang.String |
getMessagePort() |
atg.nucleus.dms.DASMessageSource |
getMessageSource() |
java.lang.String |
getMessageType() |
java.util.Dictionary |
getPropertyExceptions()
Returns the propertyExceptions property.
|
boolean |
getSendMessages() |
java.util.List |
getUncheckedFormExceptions()
Returns the array of unchecked exceptions that occurred for display in the page
|
boolean |
handleCancel(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method redirects to the value of the cancelURL property, if
that property is set to a non-null value.
|
void |
handleFormException(DropletFormException exception,
DynamoHttpServletRequest request,
DynamoHttpServletResponse response)
Called when an exception occurs while processing form submissions
|
void |
handleUncheckedFormException(java.lang.Throwable exception,
DynamoHttpServletRequest request,
DynamoHttpServletResponse response)
Called when an unchecked exception occurs while processing form submissions
|
boolean |
hasUncheckedFormExceptions()
Returns true if an error occurred while processing the form.
|
boolean |
isDeferForwardsAndRedirects()
Get whether to defer forwards and redirects until after form handling has completed, or to
execute forwards and redirects imediately.
|
boolean |
isRestorableForm() |
boolean |
isUseForwards()
Get whether to use forwards rather then redirects
|
boolean |
isValidSession(DynamoHttpServletRequest pRequest)
Returns true if this is a valid session for processing the form.
|
protected void |
redirectOrForward(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse,
java.lang.String pURL)
Forward or redirect, as required.
|
void |
resetFormExceptions()
Clears out all form exceptions
|
void |
setCancelURL(java.lang.String pCancelURL)
Sets the property CancelURL.
|
void |
setCheckForValidSession(boolean pCheckForValidSession)
Sets the property CheckForValidSession.
|
void |
setDeferForwardsAndRedirects(boolean pDeferForwardsAndRedirects)
Set whether to defer forwards and redirects until after form handling has completed, or to
execute forwards and redirects imediately.
|
void |
setFormName(java.lang.String pFormName)
Sets the property formName.
|
void |
setMessagePort(java.lang.String pMessagePort)
Sets the property messagePort.
|
void |
setMessageSource(atg.nucleus.dms.DASMessageSource pMessageSource)
Sets the property messageSource.
|
void |
setMessageType(java.lang.String pMessageType)
Sets the property messageType.
|
void |
setRestorableForm(boolean pRestorableForm)
Sets the property RestorableForm.
|
void |
setSendMessages(boolean pSendMessages)
Sets the property sendMessages to indicate if messages are to be sent.
|
void |
setUseForwards(boolean pUseForwards)
Set whether to use forwards rather then redirects.
|
afterGet, beforeGet
addLogListener, 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, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
public static final java.lang.String PARAM_USE_FORWARDS
public static final java.lang.String PARAM_DEFER_FORWARD_OR_REDIRECT
Deferred forwards and redirects allow form handlers (often those that manage their own transactions) to forward/redirect after the afterSet method has been called (once the transaction has completed). A common design pattern is to create and end a transaction in before and after set, respectively. If a form handler requests a forward inside that transaction, then we don't necessarily want to render the forward request in the same transaction. This is especially true if the form handler has rolled back the transaction. Also, deferring the forward until after the transaction completes insulates the work the form handler performed from a rollback set by the forwarded page. Likewise, when a form handler redirects, it is often valuable to defer executing a redirect until after the transaction completes to prevent the subsequent request from being processed before a transaction completes.
Set this parameter to "true" to defer forwards/redirects until after the afterSet method has been called.
public boolean beforeSet(DynamoHttpServletRequest request, DynamoHttpServletResponse response) throws DropletFormException
beforeSet
in interface DropletFormHandler
beforeSet
in class EmptyFormHandler
DropletFormException
public boolean afterSet(DynamoHttpServletRequest request, DynamoHttpServletResponse response) throws DropletFormException
afterSet
in interface DropletFormHandler
afterSet
in class EmptyFormHandler
DropletFormException
public void handleFormException(DropletFormException exception, DynamoHttpServletRequest request, DynamoHttpServletResponse response)
handleFormException
in interface DropletFormHandler
handleFormException
in class EmptyFormHandler
public void handleUncheckedFormException(java.lang.Throwable exception, DynamoHttpServletRequest request, DynamoHttpServletResponse response)
handleUncheckedFormException
in interface DropletFormHandler
handleUncheckedFormException
in class EmptyFormHandler
public void setSendMessages(boolean pSendMessages)
public boolean getSendMessages()
public void setMessageSource(atg.nucleus.dms.DASMessageSource pMessageSource)
public atg.nucleus.dms.DASMessageSource getMessageSource()
public void setFormName(java.lang.String pFormName)
public java.lang.String getFormName()
public void setMessageType(java.lang.String pMessageType)
public java.lang.String getMessageType()
public void setMessagePort(java.lang.String pMessagePort)
public java.lang.String getMessagePort()
public void setUseForwards(boolean pUseForwards)
public boolean isUseForwards()
public void setDeferForwardsAndRedirects(boolean pDeferForwardsAndRedirects)
Deferred forwards and redirects allow form handlers (often those that manage their own transactions) to forward/redirect after the afterSet method has been called (once the transaction has completed). A common design pattern is to create and end a transaction in before and after set, respectively. If a form handler requests a forward inside that transaction, then we don't necessarily want to render the forward request in the same transaction. This is especially true if the form handler has rolled back the transaction. Also, deferring the forward until after the transaction completes insulates the work the form handler performed from a rollback set by the forwarded page. Likewise, when a form handler redirects, it is often valuable to defer executing a redirect until after the transaction completes to prevent the subsequent request from being processed before a transaction completes.
Set this property to "true" to defer forwards and redirects until after the form handling has completed.
public boolean isDeferForwardsAndRedirects()
Deferred forwards and redirects allow form handlers (often those that manage their own transactions) to forward/redirect after the afterSet method has been called (once the transaction has completed). A common design pattern is to create and end a transaction in before and after set, respectively. If a form handler requests a forward inside that transaction, then we don't necessarily want to render the forward request in the same transaction. This is especially true if the form handler has rolled back the transaction. Also, deferring the forward until after the transaction completes insulates the work the form handler performed from a rollback set by the forwarded page. Likewise, when a form handler redirects, it is often valuable to defer executing a redirect until after the transaction completes to prevent the subsequent request from being processed before a transaction completes.
If this property is set to "true", forwards and redirects will be deferred until after the form handling has completed.
public java.io.Serializable createFormSubmissionMessage(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
public boolean getFormError()
public java.util.Vector getFormExceptions()
public boolean hasUncheckedFormExceptions()
public java.util.List getUncheckedFormExceptions()
public void setRestorableForm(boolean pRestorableForm)
pRestorableForm
- new value to setpublic boolean isRestorableForm()
public void setCheckForValidSession(boolean pCheckForValidSession)
pCheckForValidSession
- new value to setpublic boolean getCheckForValidSession()
public boolean isValidSession(DynamoHttpServletRequest pRequest)
public void addFormException(DropletException exc)
public void addUncheckedFormException(java.lang.Throwable exc)
public void resetFormExceptions()
public java.util.Dictionary getPropertyExceptions()
public void setCancelURL(java.lang.String pCancelURL)
public java.lang.String getCancelURL()
public boolean handleCancel(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletException
java.io.IOException
public boolean checkFormRedirect(java.lang.String pSuccessURL, java.lang.String pFailureURL, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pNoErrorsURL
- The URL to redirect to if there were no form errors.
If a null value is passed in, no redirect occurs.pErrorsURL
- The URL to redirect to if form errors were found.
If a null value is passed in, no redirect occurs.pRequest
- the servlet's requestpResponse
- the servlet's responsejavax.servlet.ServletException
- if there was an error while executing the codejava.io.IOException
- if there was an error with servlet ioprotected void redirectOrForward(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, java.lang.String pURL) throws java.io.IOException, javax.servlet.ServletException
pRequest
- the servlet's requestpResponse
- the servlet's responsepURL
- the url to redirect or forward to.java.io.IOException
javax.servlet.ServletException