atg.droplet
Class ErrorMessageForEach

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.droplet.ForEach
                              extended by atg.droplet.ErrorMessageForEach
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class ErrorMessageForEach
extends ForEach

The servlet takes a list of exceptions and renders the text of an error message for each exception, by translating the message and propertyName properties of the exception.

The list of exceptions can be specified as an input parameter in one of two ways. If you do not define a source for exceptions, the list of all exceptions that have occurred in this request is used.

Otherwise, you can specify a Vector of ServletException s as the exceptions parameter. For example, you'd add this parameter to the invocation of this servlet in a jhtml file:

     <param name="exceptions" value="bean:MyFormHandler.formExceptions">
 

The exceptions are translated into error messages using a pair of mapping tables. One keys off of the errorCode property of the exception, the other keys off of its propertyName. The tables supply specific errors to display for each exception that are likely to be encountered. If no entry is provided for a errorCode or a propertyName, the original message property in the exception is printed.

The mapping tables are created by taking the union of two different dictionaries. The default dictionary is defined with the propertyNameTable and messageTable bean properties of this servlet. The other dictionary is taken from a the propertyNameTable and messageTable request parameters passed to the servlet.

Each exception can either have an entry in the message table, the property name table or both. If both entries are present, the "message" table entry is displayed but it can use the sequence "param:propertyName" to substitute the contents of the "propertyName" table entry.

This servlet takes the same parameters as the servlet atg.droplet.ForEach to control how the exceptions are displayed. Each time that the output parameter is rendered, this servlet sets "message" and "propertyName" parameters which contain the translated values.

Note that propertyName is only associated with DropletFormExceptions - those exceptions that are generated in a failure to set the value of a bean property. For ServletExceptions, the propertyName entry is not set.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.droplet.ForEach
ARRAY, COUNT, DEBUG, ELEMENT, ELEMENT_NAME, EMPTY, INDEX, INDEX_NAME, KEY, OUTPUT, OUTPUT_END, OUTPUT_START, REVERSE_ORDER, SIZE, SORT_PROPERTIES
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
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
ErrorMessageForEach()
           
 
Method Summary
 java.lang.Object getArray(DynamoHttpServletRequest pReq)
          Returns the Vector of exceptions to display.
 java.util.Properties getMessageTable()
           
 java.util.Properties getPropertyNameTable()
           
 java.lang.String getResourceName()
           
protected  void setElementParameter(DynamoHttpServletRequest pReq, java.lang.String pElementName, java.lang.Object pValue)
          In this method, we extract the message and propertyName values that we want to render in the request first mapping them through the tables provided.
 void setMessageTable(java.util.Properties pMessageTable)
          Sets the property MessageTable.
 void setPropertyNameTable(java.util.Properties pPropertyNameTable)
          Sets the property PropertyNameTable.
 void setResourceName(java.lang.String pResourceName)
          Sets the property ResourceName.
 
Methods inherited from class atg.droplet.ForEach
getSortedArray, service, serviceArray, serviceCollection, serviceDictionary, serviceEnumeration, serviceIndexedList, serviceIterator, serviceMap, serviceMapArray, servicePrimitiveArray
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, init, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
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
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

ErrorMessageForEach

public ErrorMessageForEach()
Method Detail

setResourceName

public void setResourceName(java.lang.String pResourceName)
Sets the property ResourceName.


getResourceName

public java.lang.String getResourceName()
Returns:
The value of the property ResourceName.

setMessageTable

public void setMessageTable(java.util.Properties pMessageTable)
Sets the property MessageTable. This Properties object contains a translation from the message field of the exception to a text message to be displayed.


getMessageTable

public java.util.Properties getMessageTable()
Returns:
The value of the property MessageTable.

setPropertyNameTable

public void setPropertyNameTable(java.util.Properties pPropertyNameTable)
Sets the property PropertyNameTable. This Properties object defines a translation from the propertyName in a DropletFormException to the text description of that property as it is to be displayed to the user.


getPropertyNameTable

public java.util.Properties getPropertyNameTable()
Returns:
The value of the property PropertyNameTable.

getArray

public java.lang.Object getArray(DynamoHttpServletRequest pReq)
Returns the Vector of exceptions to display.

Overrides:
getArray in class ForEach

setElementParameter

protected void setElementParameter(DynamoHttpServletRequest pReq,
                                   java.lang.String pElementName,
                                   java.lang.Object pValue)
In this method, we extract the message and propertyName values that we want to render in the request first mapping them through the tables provided.

Overrides:
setElementParameter in class ForEach