Class BaseRequestProcessor
java.lang.Object
org.apache.struts.action.RequestProcessor
org.apache.struts.tiles.TilesRequestProcessor
com.softslate.commerce.customer.core.BaseRequestProcessor
- Direct Known Subclasses:
com.softslate.commerce.customer.core.CheckEERequestProcessor,InstallerRequestProcessor
public class BaseRequestProcessor
extends org.apache.struts.tiles.TilesRequestProcessor
Subclass of
TilesRequestProcessor that negotiates each
application request. The subclasses of this class,
CustomerRequestProcessor and
AdministratorRequestProcessor, are specified in the
<controller> tags of the struts-config.xml files, as the
request processors for the customer and adminstrator applications
respectively.- Author:
- David Tobey
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringPath to forward the request to if an error occurs when connecting to the database.static StringPath to forward the request to if the installer is not locked.(package private) static org.apache.commons.logging.LogFields inherited from class org.apache.struts.tiles.TilesRequestProcessor
definitionsFactoryFields inherited from class org.apache.struts.action.RequestProcessor
actions, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, moduleConfig, servlet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.eventbus.EventBuscreateEventBus(javax.servlet.http.HttpServletRequest request) com.google.inject.InjectorcreateGuiceInjector(javax.servlet.http.HttpServletRequest request) protected voiddoForward(String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Overrides the regular forward to use the user's custom layout.getExceptionAsString(Throwable exception) getRequestParamsDebugMessage(javax.servlet.http.HttpServletRequest request) Given a request object, converts all the incoming parameters to a string for debugging.voidinitializeEventBus(com.google.common.eventbus.EventBus eventBus, javax.servlet.http.HttpServletRequest request) com.google.inject.InjectorinitializeGuice(javax.servlet.http.HttpServletRequest request) protected voidinternalModuleRelativeForward(String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voidprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voidprocessAuditLogging(javax.servlet.http.HttpServletRequest request) Create log entries in the application's audit logs, containing all the key information about each request.protected org.apache.struts.action.ActionForwardprocessException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception exception, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping) protected voidprocessForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward) protected booleanprocessPreprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Runs initializations and other necessary routines before every request.booleansscOnPreRequestBegin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing at the beginning of each call toprocessPreProcess.booleansscOnPreRequestEnd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing at the end of each call toprocessPreProcess.booleansscOnPreRequestMiddle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing in the middle of each call toprocessPreProcess, directly after thedaoFactoryhas been initialized.Methods inherited from class org.apache.struts.tiles.TilesRequestProcessor
getDefinitionsFactory, init, initDefinitionsMapping, internalModuleRelativeInclude, processTilesDefinition, processTilesDefinitionMethods inherited from class org.apache.struts.action.RequestProcessor
destroy, doInclude, getInternal, getServletContext, processActionCreate, processActionForm, processActionPerform, processCachedMessages, processContent, processForward, processInclude, processLocale, processMapping, processMultipart, processNoCache, processPath, processPopulate, processRoles, processValidate
-
Field Details
-
log
static org.apache.commons.logging.Log log -
installerPath
Path to forward the request to if the installer is not locked. This value is/installer/Installer.do. -
errorPath
Path to forward the request to if an error occurs when connecting to the database. By default this value is/installer/Installer.do.
-
-
Constructor Details
-
BaseRequestProcessor
public BaseRequestProcessor()
-
-
Method Details
-
processPreprocess
protected boolean processPreprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Runs initializations and other necessary routines before every request.Here are the steps this method takes for each request:
- Calls
sscOnPreRequestBegin(), which can be overridden by a subclass to provide customizations. - If the
appSettingsorappComponentsobjects do not exist in the application scope, initializes them. - If a
BusinessObjectFactorydoes not exist in the request scope, initializes a new one. - If a
DAOFactorydoes not exist in the application scope, initializes a new one, including initializing Hibernate. - Assigns the application scope's
DAOFactoryto the request'sBusinessObjectFactory. - If a
Settingsinstance does not exist in the application scope, initializes a new one in the application and request scope, and assigns it to the application'sDAOFactoryand the request'sBusinessObjectFactory. - If a
Userdoes not exist in the session scope, or if the user's order has just been placed or has been corrupted somehow, initializes a new one in the session scope. - Assigns the session scope's
Userto the request'sBusinessObjectFactory. - If the store's
categoryTree,builtInCategoriesorstatesAndCountriesattributes do not exist in the application scope, initializes them usingProductInitializerandOrderInitializer. - Calls
sscOnPreRequestEnd(), which can be overridden by a subclass to provide customizations.
- Overrides:
processPreprocessin classorg.apache.struts.action.RequestProcessor- Parameters:
request- The servlet request we are processing.response- The servlet response we are creating.
- Calls
-
createEventBus
public com.google.common.eventbus.EventBus createEventBus(javax.servlet.http.HttpServletRequest request) -
initializeEventBus
public void initializeEventBus(com.google.common.eventbus.EventBus eventBus, javax.servlet.http.HttpServletRequest request) -
initializeGuice
public com.google.inject.Injector initializeGuice(javax.servlet.http.HttpServletRequest request) -
createGuiceInjector
public com.google.inject.Injector createGuiceInjector(javax.servlet.http.HttpServletRequest request) -
sscOnPreRequestBegin
public boolean sscOnPreRequestBegin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing at the beginning of each call toprocessPreProcess. It is intended to be overridden by subclasses for customizations. This method should returnfalseto signalprocessPreProcessto stop futher processing and returnfalseitself.- Parameters:
request- The servlet request we are processing.response- The servlet response we are creating.- Returns:
trueif the processing was successful,falseif processing in the request should stop.
-
sscOnPreRequestMiddle
public boolean sscOnPreRequestMiddle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing in the middle of each call toprocessPreProcess, directly after thedaoFactoryhas been initialized. It is intended to be overridden by subclasses for customizations. This method should returnfalseto signalprocessPreProcessto stop futher processing and returnfalseitself.- Parameters:
request- The servlet request we are processing.response- The servlet response we are creating.- Returns:
trueif the processing was successful,falseif processing in the request should stop.
-
sscOnPreRequestEnd
public boolean sscOnPreRequestEnd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs custom processing at the end of each call toprocessPreProcess. This method should returnfalseto signalprocessPreProcessto returnfalseitself.- Parameters:
request- The servlet request we are processing.response- The servlet response we are creating.- Returns:
trueif the processing was successful,falseif processing should stop.
-
process
public void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException - Overrides:
processin classorg.apache.struts.action.RequestProcessor- Throws:
IOExceptionjavax.servlet.ServletException
-
processException
protected org.apache.struts.action.ActionForward processException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception exception, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping) throws IOException, javax.servlet.ServletException - Overrides:
processExceptionin classorg.apache.struts.action.RequestProcessor- Throws:
IOExceptionjavax.servlet.ServletException
-
getExceptionAsString
-
processForwardConfig
protected void processForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward) throws IOException, javax.servlet.ServletException - Overrides:
processForwardConfigin classorg.apache.struts.tiles.TilesRequestProcessor- Throws:
IOExceptionjavax.servlet.ServletException
-
internalModuleRelativeForward
protected void internalModuleRelativeForward(String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException - Overrides:
internalModuleRelativeForwardin classorg.apache.struts.tiles.TilesRequestProcessor- Throws:
IOExceptionjavax.servlet.ServletException
-
doForward
protected void doForward(String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException Overrides the regular forward to use the user's custom layout. Replaces pages matching the system layout directory with the user's custom layout directory. If the resulting page doesn't map to an existing file, uses the original instead.This method affects the forwards to the Tiles definitions for leftLayout, centerLayout, and layout. The same process happens in
AppInsertTagto handle forwards coming from tiles insert tags.- Overrides:
doForwardin classorg.apache.struts.tiles.TilesRequestProcessor- Parameters:
uri- The URI we're forwarding the request to, which may be modified in this method.request- The servlet request we are processing.response- The servlet response we are creating.- Throws:
IOExceptionjavax.servlet.ServletException
-
getRequestParamsDebugMessage
Given a request object, converts all the incoming parameters to a string for debugging. The values of certain parameters such as passwords are masked for security.- Parameters:
request- The current request object.- Returns:
- A String representing the name value pairs of the request parameters.
-
processAuditLogging
public void processAuditLogging(javax.servlet.http.HttpServletRequest request) Create log entries in the application's audit logs, containing all the key information about each request.- Parameters:
request- The current request object.
-