com.boylesoftware.cb2.presentation.servlet
Class CB2RequestProcessor

java.lang.Object
  extended byorg.apache.struts.action.RequestProcessor
      extended bycom.boylesoftware.cb2.presentation.servlet.CB2RequestProcessor

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

CB2 Struts request processor. This processor is automatically set up for a module by the CB2PlugIn. You application can extend this class to provide additional request processing logic. If you subclass this class you will have to specify the your class name to the CB2PlugIn by setting its controller property (or, as an alternative, by providing processorClass attribute to the controller element in the Struts configuration file).

This class logs messages under "com.boylesoftware.cb2.CTRLER" log channel.

Version:
$Id: CB2RequestProcessor.java,v 1.5 2004/04/08 18:32:23 levahim Exp $
Author:
Lev Himmelfarb

Field Summary
 
Fields inherited from class org.apache.struts.action.RequestProcessor
actions, appConfig, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, servlet
 
Constructor Summary
CB2RequestProcessor()
           
 
Method Summary
 void destroy()
          Gracefully shutdown the application.
 void init(org.apache.struts.action.ActionServlet actionServlet, org.apache.struts.config.ModuleConfig moduleConfig)
          Initializes the request processor.
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a request.
protected  org.apache.struts.action.ActionForward processActionPerform(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.Action action, org.apache.struts.action.ActionForm form, org.apache.struts.action.ActionMapping mapping)
          Overrides the basic Struts method that calls actions.
protected  void processForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward)
          Forward to the specified destination by the specified mechanism if an ActionForward instance was returned by the Action.
protected  org.apache.struts.config.ForwardConfig processPostprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward)
          Performs request post-processing after the action has been executed and returned a forward.
 
Methods inherited from class org.apache.struts.action.RequestProcessor
doForward, doInclude, getDebug, getInternal, getServletContext, internalModuleRelativeForward, internalModuleRelativeInclude, log, log, processActionCreate, processActionForm, processActionForward, processContent, processException, processForward, processInclude, processLocale, processMapping, processMultipart, processNoCache, processPath, processPopulate, processPreprocess, processRoles, processValidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CB2RequestProcessor

public CB2RequestProcessor()
Method Detail

init

public void init(org.apache.struts.action.ActionServlet actionServlet,
                 org.apache.struts.config.ModuleConfig moduleConfig)
          throws javax.servlet.ServletException
Initializes the request processor. Called by Struts framework.

Throws:
javax.servlet.ServletException - if an error occurs during the initialization.

destroy

public void destroy()
Gracefully shutdown the application. This method is called when the container unloads the ControllerServlet, which usually happens when the web-application goes down.


process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Process a request.

Parameters:
request - the HTTP request to be processed.
response - the HTTP response to be sent back to the client.
Throws:
javax.servlet.ServletException - indicates a serious error in the application.
java.io.IOException - if an I/O error occurs.

processActionPerform

protected org.apache.struts.action.ActionForward processActionPerform(javax.servlet.http.HttpServletRequest request,
                                                                      javax.servlet.http.HttpServletResponse response,
                                                                      org.apache.struts.action.Action action,
                                                                      org.apache.struts.action.ActionForm form,
                                                                      org.apache.struts.action.ActionMapping mapping)
                                                               throws java.io.IOException,
                                                                      javax.servlet.ServletException
Overrides the basic Struts method that calls actions. This method checks if the action is actually a page defined in pages-config.xml and if so calls the appropriate preactions first.

Parameters:
request - request we are processing.
response - response we are creating.
action - action to be called.
form - form to pass to the action.
mapping - action mapping to pass to the action.
Returns:
action forward returned by the action.
Throws:
java.io.IOException - if I/O error occurs.
javax.servlet.ServletException - if other error occurs.

processPostprocess

protected org.apache.struts.config.ForwardConfig processPostprocess(javax.servlet.http.HttpServletRequest request,
                                                                    javax.servlet.http.HttpServletResponse response,
                                                                    org.apache.struts.config.ForwardConfig forward)
                                                             throws javax.servlet.ServletException,
                                                                    java.io.IOException
Performs request post-processing after the action has been executed and returned a forward. This method is called from the overriden processForwardConfig and adds additional functionality, such as special tokens in the forward's path attribute.

In the path attribute of a forward element of your action mapping you can specify special lexical tokens, which are recognized by this method and replaced by some values, depending on the token, before the path is passed further to Struts. Currently CB2 recognizes the following tokens:

Also, this method actually performs the logout operations if the action asked for it.

Parameters:
request - request we are processing.
response - response we are creating.
forward - forward controlling where we go next.
Returns:
possibly corrected forward to be passed to Struts.
Throws:
java.io.IOException - if I/O error occurs.
javax.servlet.ServletException - if other error occurs.

processForwardConfig

protected void processForwardConfig(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    org.apache.struts.config.ForwardConfig forward)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Forward to the specified destination by the specified mechanism if an ActionForward instance was returned by the Action. This method overrides the original one from Struts and adds processPostprocess method call.

Parameters:
request - request we are processing.
response - response we are creating.
forward - forward controlling where we go next.
Throws:
java.io.IOException - if I/O error occurs.
javax.servlet.ServletException - if other error occurs.
See Also:
processPostprocess(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.config.ForwardConfig)


Copyright © 2002,2003,2004 - Boyle Software, Inc.