atg.droplet
Class DropletEventServlet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.droplet.DropletEventServlet
All Implemented Interfaces:
DropletConstants, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class DropletEventServlet
extends PipelineableServletImpl
implements DropletConstants


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String HANDLE_OBJECT_ONE
           
static java.lang.String HANDLE_OBJECT_TWO
           
static java.lang.String HANDLE_TYPE_ONE
           
static java.lang.String HANDLE_TYPE_TWO
           
protected static java.lang.String INVOKE_FORM_HANDLER
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.droplet.DropletConstants
DROPLET_ANCHOR_QUALIFIER, DROPLET_ANCHOR_VALUE, DROPLET_ARGUMENTS, DROPLET_BEAN_PREFIX, DROPLET_BEFORE_GET_ATTRIBUTE, DROPLET_EVENT_ATTRIBUTE, DROPLET_EVENT_PREFIX, DROPLET_EXCEPTIONS_ATTRIBUTE, DROPLET_PARAM_PREFIX, DROPLET_PROPERTY_PREFIX, DROPLET_SESSION_CONF, DROPLET_SUBMIT_VALUE_PREFIX, OBJECT_BEFORE_GET_ATTRIBUTE, PRIORITY_DEFAULT, SUBMIT_PRIORITY_DEFAULT, UNCHECKED_DROPLET_EXCEPTIONS_ATTRIBUTE
 
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
DropletEventServlet()
           
 
Method Summary
 AnchorTag addAnchor(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes, java.lang.String pId, java.lang.String pPropertyPath)
           
 AnchorTag addAnchor(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes, java.lang.String pId, java.lang.String pPropertyPath, TagConverter pConverter, java.util.Properties pConverterArgs)
           
 FormTag addForm(java.lang.String pId)
          Looks up the form defined by the id specified.
 FormTag addForm(java.lang.String pId, java.lang.String pSyncPath)
          Looks up the form defined by the id specified.
 void addQueryParameter(DynamoHttpServletRequest pRequest, java.lang.String pName, java.lang.String pValue)
          Adds a query paremeter for the next request, using the TagNameEncoderService.
protected  javax.servlet.Servlet createAdminServlet()
          Creates and returns a new Servlet that will administer this service.
 void doStartService()
          Initializes this services after it is created by Nucleus.
protected  java.lang.String getAdditionalRequestDetails(DynamoHttpServletRequest pReq)
          Get some additional request details.
static java.lang.Object[] getAlternateFormParams(javax.servlet.ServletRequest pRequest)
          Returns the actual objects that will be used as arguments when invoking form handler methods.
static java.lang.Class[] getAlternateFormParamTypes(javax.servlet.ServletRequest pRequest)
          Returns the types of any alternate form parameters.
 java.lang.String[] getDynamoHandlerPrefixes()
           
 java.lang.String[] getHandlerTypes()
           
 java.lang.String[] getPropertyPathsForForm(java.lang.String pId)
          Get the property paths fo the specified form.
 boolean getReportDropletExceptions()
          Gets the ReportDropletExceptions property.
 java.lang.String getSkipDynamoFormHandlerParam()
           
 atg.servlet.pagecompile.taglib.TagNameEncoderService getTagNameEncoderService()
          Gets the TagNameEncoderService.
 java.lang.String[] getXmlMimeTypes()
          Returns the array of Strings of XML mime types.
static boolean hasAlternateFormParamTypes(javax.servlet.ServletRequest pRequest)
          Checks the given request object for altername form parameter attributes.
 boolean hasAlternateHandlerTypes()
          Returns true if altername parameters for handleXXX methods have been specified.
protected  void initializeHandlerTypes()
           
static void invokeDropletAfterGets(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Invokes the afterGet methods for formhandlers that implement DropletFormHandler
static void invokeObjectAfterGets(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Invokes the afterGet methods for formhandlers that implement ObjectFormHandler
 boolean isDeferForwardsAndRedirects()
          Get whether to defer forwards and redirects until after form handling has completed, or to execute forwards and redirects imediately.
 boolean isEnforceSessionConfirmation()
          Whether to enforce session confirmation number matching.
 boolean isFormSecurity()
          Gets the FormSecurity property.
 boolean isWarnOnSessionConfirmationFailure()
          Whether to warn on session confirmation failure.
 FormTag removeForm(java.lang.String pId)
          Remove the form specified by its id.
 boolean requestMatchesDynamoPrefixes(java.lang.String pArgs)
           
 boolean sendEvents(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Looks up the handler for the any possible Droplet events in this request and delivers them.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Services a DynamoHttpServletRequest/Response pair
static void setAlternateFormParams(java.lang.Object pParamOne, java.lang.Object pParamTwo, javax.servlet.ServletRequest pRequest)
          Sets the actual objects that will be used as arguments when invoking form handler methods such as handleXXX,beforeGet,afterGet,beforeSet,afterSet
static void setAlternateFormParamTypes(java.lang.Class pParamOne, java.lang.Class pParamTwo, javax.servlet.ServletRequest pRequest)
          Sets the alternate parameter types for form handling.
 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 setDynamoHandlerPrefixes(java.lang.String[] pDynamoHandlerPrefixes)
           
 void setEnforceSessionConfirmation(boolean pEnforceSessionConfirmation)
          Whether to enforce session confirmation number matching.
 void setFormSecurity(boolean pSecurity)
           
 void setHandlerTypes(java.lang.String[] pTypes)
          Sets the array of parameter types that should be accepted for handleXXX methods in FormHandler.
 void setReportDropletExceptions(boolean pReport)
           
 void setSkipDynamoFormHandlerParam(java.lang.String pSkip)
           
 void setTagNameEncoderService(atg.servlet.pagecompile.taglib.TagNameEncoderService pTagNameEncoderService)
          Sets the TagNameEncoderService.
 void setWarnOnSessionConfirmationFailure(boolean pWarnOnSessionConfirmationFailure)
          Whether to warn on session confirmation failure.
 void setXmlMimeTypes(java.lang.String[] pXmlMimeTypes)
          Sets the array of Strings of XML mime types.
 boolean validateSessionConfirmationNumber(DynamoHttpServletRequest pReq)
          Validate the session confirmation number.
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, 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, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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


INVOKE_FORM_HANDLER

protected static final java.lang.String INVOKE_FORM_HANDLER
See Also:
Constant Field Values

HANDLE_TYPE_ONE

public static final java.lang.String HANDLE_TYPE_ONE
See Also:
Constant Field Values

HANDLE_TYPE_TWO

public static final java.lang.String HANDLE_TYPE_TWO
See Also:
Constant Field Values

HANDLE_OBJECT_ONE

public static final java.lang.String HANDLE_OBJECT_ONE
See Also:
Constant Field Values

HANDLE_OBJECT_TWO

public static final java.lang.String HANDLE_OBJECT_TWO
See Also:
Constant Field Values
Constructor Detail

DropletEventServlet

public DropletEventServlet()
Method Detail

setSkipDynamoFormHandlerParam

public void setSkipDynamoFormHandlerParam(java.lang.String pSkip)

getSkipDynamoFormHandlerParam

public java.lang.String getSkipDynamoFormHandlerParam()

setEnforceSessionConfirmation

public void setEnforceSessionConfirmation(boolean pEnforceSessionConfirmation)
Whether to enforce session confirmation number matching.


isEnforceSessionConfirmation

public boolean isEnforceSessionConfirmation()
Whether to enforce session confirmation number matching.


setWarnOnSessionConfirmationFailure

public void setWarnOnSessionConfirmationFailure(boolean pWarnOnSessionConfirmationFailure)
Whether to warn on session confirmation failure.


isWarnOnSessionConfirmationFailure

public boolean isWarnOnSessionConfirmationFailure()
Whether to warn on session confirmation failure.


setDynamoHandlerPrefixes

public void setDynamoHandlerPrefixes(java.lang.String[] pDynamoHandlerPrefixes)

getDynamoHandlerPrefixes

public java.lang.String[] getDynamoHandlerPrefixes()

setFormSecurity

public void setFormSecurity(boolean pSecurity)

isFormSecurity

public boolean isFormSecurity()
Gets the FormSecurity property. Should we check the form submit URL/anchor href with the actionURL/Href list


getXmlMimeTypes

public java.lang.String[] getXmlMimeTypes()
Returns the array of Strings of XML mime types.


setXmlMimeTypes

public void setXmlMimeTypes(java.lang.String[] pXmlMimeTypes)
Sets the array of Strings of XML mime types.


setHandlerTypes

public void setHandlerTypes(java.lang.String[] pTypes)
Sets the array of parameter types that should be accepted for handleXXX methods in FormHandler. The first element in the array corresponds to the type of the first method parameter, the second element corresponds to the type of the second parameter. If this value is set to null then the default parameter types ,javax.servlet.ServletRequest and javax.servlet.ServletResponse will be used instead.


getHandlerTypes

public java.lang.String[] getHandlerTypes()

setTagNameEncoderService

public void setTagNameEncoderService(atg.servlet.pagecompile.taglib.TagNameEncoderService pTagNameEncoderService)
Sets the TagNameEncoderService.


getTagNameEncoderService

public atg.servlet.pagecompile.taglib.TagNameEncoderService getTagNameEncoderService()
Gets the TagNameEncoderService.


setDeferForwardsAndRedirects

public void setDeferForwardsAndRedirects(boolean pDeferForwardsAndRedirects)
Set whether to defer forwards and redirects until after form handling has completed, or to execute forwards and redirects imediately.

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.


isDeferForwardsAndRedirects

public boolean isDeferForwardsAndRedirects()
Get whether to defer forwards and redirects until after form handling has completed, or to execute forwards and redirects imediately.

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.


addForm

public FormTag addForm(java.lang.String pId)
Looks up the form defined by the id specified. If no form exists, a new form is created. In either case a reference to the form is returned.

Parameters:
pId - the unique string id for the form, typically defined by the the URI of the page containing the page.

addForm

public FormTag addForm(java.lang.String pId,
                       java.lang.String pSyncPath)
Looks up the form defined by the id specified. If no form exists, a new form is created. In either case a reference to the form is returned.

Parameters:
pId - the unique string id for the form, typically defined by the the URI of the page containing the page.
pSyncPath - if not null, the path name of a component to synchronize with when processing the form submission. This means that only one form will be submitted to this component at a time.

removeForm

public FormTag removeForm(java.lang.String pId)
Remove the form specified by its id.

Parameters:
pId - The form id.
Returns:
the removed FormTag, or null if nothing removed.

getPropertyPathsForForm

public java.lang.String[] getPropertyPathsForForm(java.lang.String pId)
Get the property paths fo the specified form.

Parameters:
pId - The form id.

addAnchor

public AnchorTag addAnchor(DynamoHttpServletRequest pReq,
                           DynamoHttpServletResponse pRes,
                           java.lang.String pId,
                           java.lang.String pPropertyPath)
                    throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

addAnchor

public AnchorTag addAnchor(DynamoHttpServletRequest pReq,
                           DynamoHttpServletResponse pRes,
                           java.lang.String pId,
                           java.lang.String pPropertyPath,
                           TagConverter pConverter,
                           java.util.Properties pConverterArgs)
                    throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

addQueryParameter

public void addQueryParameter(DynamoHttpServletRequest pRequest,
                              java.lang.String pName,
                              java.lang.String pValue)
Adds a query paremeter for the next request, using the TagNameEncoderService. If the service is null, the request is assumed to be a DynamoHttpServletRequest.


doStartService

public void doStartService()
Initializes this services after it is created by Nucleus.

Overrides:
doStartService in class GenericService

initializeHandlerTypes

protected void initializeHandlerTypes()

hasAlternateHandlerTypes

public boolean hasAlternateHandlerTypes()
Returns true if altername parameters for handleXXX methods have been specified. The Class definition for each paramter type must exist in the classpath otherwise the default parameter types ServletRequest , ServletResponse are used.

Returns:
true if an altername handleXXX method param type has been specified.

sendEvents

public boolean sendEvents(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws DropletException,
                          javax.servlet.ServletException,
                          java.io.IOException
Looks up the handler for the any possible Droplet events in this request and delivers them.

Throws:
DropletException
javax.servlet.ServletException
java.io.IOException

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Description copied from class: PipelineableServletImpl
Services a DynamoHttpServletRequest/Response pair

Overrides:
service in class PipelineableServletImpl
Throws:
javax.servlet.ServletException - if an error occurred while processing the servlet request
java.io.IOException - if an error occurred while reading or writing the servlet request

invokeDropletAfterGets

public static void invokeDropletAfterGets(DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
Invokes the afterGet methods for formhandlers that implement DropletFormHandler

Parameters:
pRequest -
pResponse -

invokeObjectAfterGets

public static void invokeObjectAfterGets(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
Invokes the afterGet methods for formhandlers that implement ObjectFormHandler

Parameters:
pRequest -
pResponse -

createAdminServlet

protected javax.servlet.Servlet createAdminServlet()
Creates and returns a new Servlet that will administer this service.

Overrides:
createAdminServlet in class PipelineableServletImpl

setReportDropletExceptions

public void setReportDropletExceptions(boolean pReport)

getReportDropletExceptions

public boolean getReportDropletExceptions()
Gets the ReportDropletExceptions property. Should we report droplet exceptions to the reader of the page or just send them to the handleXXX method so that the form handler can deal with them.


getAlternateFormParamTypes

public static java.lang.Class[] getAlternateFormParamTypes(javax.servlet.ServletRequest pRequest)
Returns the types of any alternate form parameters. Typically forms' handleXXX methods take DynamoHttpServletRequest/DynamoHttpServletResponse. In some environments, such as JSR168 Portals, alternate parameter types may be required.

Parameters:
pRequest -
Returns:

setAlternateFormParams

public static void setAlternateFormParams(java.lang.Object pParamOne,
                                          java.lang.Object pParamTwo,
                                          javax.servlet.ServletRequest pRequest)
Sets the actual objects that will be used as arguments when invoking form handler methods such as handleXXX,beforeGet,afterGet,beforeSet,afterSet

See Also:
getAlternateFormParams

getAlternateFormParams

public static java.lang.Object[] getAlternateFormParams(javax.servlet.ServletRequest pRequest)
Returns the actual objects that will be used as arguments when invoking form handler methods.

See Also:
setAlternateFormParams

setAlternateFormParamTypes

public static void setAlternateFormParamTypes(java.lang.Class pParamOne,
                                              java.lang.Class pParamTwo,
                                              javax.servlet.ServletRequest pRequest)
Sets the alternate parameter types for form handling. This method must be called before the DropletEventServlet is invoked in the pipeline.

Parameters:
pParamOne -
pParamTwo -
pRequest -

hasAlternateFormParamTypes

public static boolean hasAlternateFormParamTypes(javax.servlet.ServletRequest pRequest)
Checks the given request object for altername form parameter attributes.

Parameters:
pRequest -
Returns:

requestMatchesDynamoPrefixes

public boolean requestMatchesDynamoPrefixes(java.lang.String pArgs)
Parameters:
pRequest -
Returns:

validateSessionConfirmationNumber

public boolean validateSessionConfirmationNumber(DynamoHttpServletRequest pReq)
Validate the session confirmation number. A return value of false means that the droplet event processing should be denied. True means allow event processing.


getAdditionalRequestDetails

protected java.lang.String getAdditionalRequestDetails(DynamoHttpServletRequest pReq)
Get some additional request details. Used when logging session confirmation warnings.

Parameters:
pReq - the request from which to get additional details