com.ivata.mask.web.struts
Class MaskRequestProcessor

java.lang.Object
  extended byorg.apache.struts.action.RequestProcessor
      extended bycom.ivata.mask.web.struts.MaskRequestProcessor

public class MaskRequestProcessor
extends org.apache.struts.action.RequestProcessor

Extend from this class if you _don't_ want to use Struts Tiles .

Since:
ivata masks 0.3 (2004-05-11)
Version:
$Revision: 1.12 $
Author:
Colin MacLeod colin.macleod@ivata.com

Field Summary
 
Fields inherited from class org.apache.struts.action.RequestProcessor
actions, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, log, moduleConfig, servlet
 
Constructor Summary
MaskRequestProcessor(com.ivata.mask.MaskFactory maskFactory, com.ivata.mask.persistence.PersistenceManager persistenceManager)
           Initializes the mask factory, the value object locator and the the standard field value converters.
 
Method Summary
protected  org.apache.struts.action.Action createAction(java.lang.String className, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           Override this method to define how to create actions in your environment.
protected  org.apache.struts.action.ActionForm createActionForm(org.apache.struts.config.FormBeanConfig formBeanConfig, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           Override this method to define how to create action forms in your environment.
protected  MaskRequestProcessorImplementation getImplementation()
           
 void init(org.apache.struts.action.ActionServlet servletParam, org.apache.struts.config.ModuleConfig moduleConfigParam)
          Refer to RequestProcessor.init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig).
protected  org.apache.struts.action.Action processActionCreate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           Overridden to create actions, since our actions have custom constructor parameters.
protected  org.apache.struts.action.ActionForm processActionForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
           Overridden to create forms, since our forms have custom constructor parameters.
protected  void processPopulate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
           Overridden to populate forms, and convert the string values of value object properties into the correct form for their class.
protected  void setImplementation(MaskRequestProcessorImplementation implementationParam)
          Refer to #getimplementation.
 
Methods inherited from class org.apache.struts.action.RequestProcessor
destroy, doForward, doInclude, getInternal, getServletContext, internalModuleRelativeForward, internalModuleRelativeInclude, log, log, process, processActionPerform, processCachedMessages, processContent, processException, processForward, processForwardConfig, processInclude, processLocale, processMapping, processMultipart, processNoCache, processPath, processPreprocess, processRoles, processValidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaskRequestProcessor

public MaskRequestProcessor(com.ivata.mask.MaskFactory maskFactory,
                            com.ivata.mask.persistence.PersistenceManager persistenceManager)

Initializes the mask factory, the value object locator and the the standard field value converters.

Parameters:
maskFactory - needed to access the masks and groups of masks.
persistenceManager - used to locate the value objects by their shared base class.
Method Detail

createAction

protected org.apache.struts.action.Action createAction(java.lang.String className,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response,
                                                       org.apache.struts.action.ActionMapping mapping)
                                                throws java.io.IOException

Override this method to define how to create actions in your environment. This lets you use ivata masks with a standard framework.

The default implementation looks for the action classes it knows about and initializes them directly. This is a simple starting point; in real life it is better to use a standard framework such as picocontainer .

Parameters:
className - full path and name of the action class to be created.
request - request for which we are creating an action.
response - response we are sending.
mapping - Struts mapping.
Returns:
valid action for the path, or null if the action can and should be created using the default Struts framework.
Throws:
java.io.IOException - if the action cannot be created.

createActionForm

protected org.apache.struts.action.ActionForm createActionForm(org.apache.struts.config.FormBeanConfig formBeanConfig,
                                                               javax.servlet.http.HttpServletRequest request,
                                                               javax.servlet.http.HttpServletResponse response,
                                                               org.apache.struts.action.ActionMapping mapping)
                                                        throws com.ivata.mask.util.SystemException

Override this method to define how to create action forms in your environment. This lets you use ivata masks with a standard framework.

The default implementation looks for the form classes it knows about and initializes them directly. This is a simple starting point; in real life it is better to use a standard framework such as picocontainer .

Parameters:
formBeanConfig - instance of FormBeanConfig defining the form to be created.
request - request for which we are creating an action.
response - response we are sending.
mapping - Struts mapping.
Returns:
valid action for the path, or null if the form can and should be created using the default Struts framework.
Throws:
com.ivata.mask.util.SystemException - if the form cannot be created for any reason.

getImplementation

protected MaskRequestProcessorImplementation getImplementation()
Returns:
Returns the implementation.

init

public void init(org.apache.struts.action.ActionServlet servletParam,
                 org.apache.struts.config.ModuleConfig moduleConfigParam)
          throws javax.servlet.ServletException
Refer to RequestProcessor.init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig).

Parameters:
servletParam - Refer to RequestProcessor.init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig).
moduleConfigParam - Refer to RequestProcessor.init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig).
Throws:
javax.servlet.ServletException - Refer to RequestProcessor.init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig).

processActionCreate

protected org.apache.struts.action.Action processActionCreate(javax.servlet.http.HttpServletRequest request,
                                                              javax.servlet.http.HttpServletResponse response,
                                                              org.apache.struts.action.ActionMapping mapping)
                                                       throws java.io.IOException

Overridden to create actions, since our actions have custom constructor parameters. Don't try to override this method: override createAction instead.

Parameters:
request - request for which we are creating an action.
response - response we are sending.
mapping - Struts mapping.
Returns:
valid action for the path.
Throws:
java.io.IOException - Refer to RequestProcessor.processActionCreate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionMapping).
See Also:
RequestProcessor.processActionCreate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionMapping)

processActionForm

protected final org.apache.struts.action.ActionForm processActionForm(javax.servlet.http.HttpServletRequest request,
                                                                      javax.servlet.http.HttpServletResponse response,
                                                                      org.apache.struts.action.ActionMapping mapping)

Overridden to create forms, since our forms have custom constructor parameters. Don't try to override this method: override createActionForm instead.

Parameters:
request - servlet request we are processing.
response - servlet response we are creating.
mapping - current Struts action mapping we are processing.
Returns:
valid action form.
See Also:
RequestProcessor.processActionForm(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionMapping)

processPopulate

protected void processPopulate(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               org.apache.struts.action.ActionForm form,
                               org.apache.struts.action.ActionMapping mapping)
                        throws javax.servlet.ServletException

Overridden to populate forms, and convert the string values of value object properties into the correct form for their class.

Parameters:
request - servlet request we are processing.
response - servlet response we are creating.
form - form instance we are populating.
mapping - Struts mapping we are using.
Throws:
javax.servlet.ServletException - if an exception is thrown while setting property values
See Also:
RequestProcessor.processPopulate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping)

setImplementation

protected void setImplementation(MaskRequestProcessorImplementation implementationParam)
Refer to #getimplementation.

Parameters:
implementationParam - Refer to #getimplementation.


Copyright © 2001-2005 ivata limited. All Rights Reserved.