org.apache.struts.tiles
Class ActionComponentServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.struts.action.ActionServlet
                    |
                    +--org.apache.struts.tiles.ActionComponentServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ActionComponentServlet
extends org.apache.struts.action.ActionServlet

Action Servlet to be used with Tiles and Struts 1.0.x. For Struts 1.1, use TilesPlugin and eventualy TilesRequestProcessor. This servlet extends struts one. It adds channels and screens dispatching capabilities. We overide all methods that do request forward (i.e. 'processActionForward' and 'processValidate') in order to call a new method performing forward. In fact, we copy methods to overide, and change lines doing forward which now call 'processForward()'. Rest of the method is unchanged. This new method could now be overiden in order to dispatch request before forwarding. Compliant to ActionServlet from struts 2001/06/25 00:02:27

See Also:
Serialized Form

Field Summary
private  DefinitionsFactory definitionsFactory
          Definitions factory
 
Fields inherited from class org.apache.struts.action.ActionServlet
config, configDigester, convertNull, dataSources, debug, detail, internal, internalName, log, processor, registrations, servletMapping, servletName
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Constructor Summary
ActionComponentServlet()
           
 
Method Summary
protected  void doForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Do a forward, and eventually catch uri containing Tiles definition.
 void init()
          Init method.
 void initComponentDefinitionsMapping()
          Read component instance mapping configuration file.
protected  void processActionForward(org.apache.struts.action.ActionForward forward, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Overload struts1.0 counterpart in order to catch forward calls.
protected  boolean processForward(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Overload struts1.0 counterpart in order to catch forward calls.
protected  void processForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Deprecated. use doForward instead
protected  boolean processInclude(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Overload struts1.0 counterpart in order to catch include calls.
protected  boolean processValidate(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Overload struts1.0 counterpart in order to catch forward calls.
 
Methods inherited from class org.apache.struts.action.ActionServlet
addServletMapping, destroy, destroyApplications, destroyConfigDigester, destroyDataSources, destroyInternal, doGet, doPost, findDataSource, findFormBean, findForward, findMapping, getApplicationConfig, getDebug, getInternal, getRequestProcessor, getResources, initApplicationConfig, initApplicationDataSources, initApplicationMessageResources, initApplicationPlugIns, initConfigDigester, initDataSources, initInternal, initOther, initServlet, log, process
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definitionsFactory

private DefinitionsFactory definitionsFactory
Definitions factory

Constructor Detail

ActionComponentServlet

public ActionComponentServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Init method. This method is call on any servlet.

Overrides:
init in class org.apache.struts.action.ActionServlet
javax.servlet.ServletException

initComponentDefinitionsMapping

public void initComponentDefinitionsMapping()
                                     throws javax.servlet.ServletException
Read component instance mapping configuration file. This is where we read files properties.

javax.servlet.ServletException

processActionForward

protected void processActionForward(org.apache.struts.action.ActionForward forward,
                                    org.apache.struts.action.ActionMapping mapping,
                                    org.apache.struts.action.ActionForm formInstance,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Overload struts1.0 counterpart in order to catch forward calls. This is an exact copy, except the call to RequestDispatcher.forward() replaced by doForward(). This method is only used with Struts1.0.x Forward to the specified destination, by the specified mechanism, if an ActionForward instance was returned by the Action.

Parameters:
forward - The ActionForward returned by our action
mapping - The ActionMapping we are processing
formInstance - The ActionForm we are processing
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processValidate

protected boolean processValidate(org.apache.struts.action.ActionMapping mapping,
                                  org.apache.struts.action.ActionForm formInstance,
                                  javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws java.io.IOException,
                                  javax.servlet.ServletException
Overload struts1.0 counterpart in order to catch forward calls. This is an exact copy, except the call to RequestDispatcher.forward() replaced by doForward(). This method is only used with Struts1.0.x Call the validate() method of the specified ActionForm, and forward back to the input form if there are any errors. Return true if we should continue processing (and call the Action class perform() method), or return false if we have already forwarded control back to the input form.

Parameters:
mapping - The ActionMapping we are processing
formInstance - The ActionForm we are processing
request - The servlet request we are processing
response - The servlet response we are processing
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

processForward

protected boolean processForward(org.apache.struts.action.ActionMapping mapping,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Overload struts1.0 counterpart in order to catch forward calls. This is an exact copy, except the call to RequestDispatcher.forward() replaced by doForward(). This method is only used with Struts1.0.x Process a forward requested by this mapping, if any. Return true if processing of this request should continue (i.e. be processed by an Action class), or false if we have already handled this request.

Parameters:
mapping - The ActionMapping we are processing
request - The request we are processing
response - The response we are processing
Throws:
java.io.IOException - if the included resource throws an exception
javax.servlet.ServletException - if the included resource throws an exception

processInclude

protected boolean processInclude(org.apache.struts.action.ActionMapping mapping,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws java.io.IOException,
                                 javax.servlet.ServletException
Overload struts1.0 counterpart in order to catch include calls. This is an exact copy, except the call to RequestDispatcher.include() replaced by doInclude(). This method is only used with Struts1.0.x Process an include requested by this mapping, if any. Return true if processing of this request should continue (i.e. be processed by an Action class), or false if we have already handled this request.

Parameters:
mapping - The ActionMapping we are processing
request - The request we are processing
response - The response we are processing
Throws:
java.io.IOException - if the included resource throws an exception
javax.servlet.ServletException - if the included resource throws an exception

processForward

protected void processForward(java.lang.String uri,
                              javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws java.io.IOException,
                              javax.servlet.ServletException
Deprecated. use doForward instead

Do forward, and eventually catch uri containing Tiles definition. Method left for compatibility reasons.

Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
java.io.IOException
javax.servlet.ServletException

doForward

protected void doForward(java.lang.String uri,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException,
                         javax.servlet.ServletException
Do a forward, and eventually catch uri containing Tiles definition. If uri is a valid uri, do a forward to it. If uri is a valid definition name, Tiles context is created from definition, and definition path is used as uri.

Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
java.io.IOException
javax.servlet.ServletException


Copyright 2000-2002 - Cedric Dumoulin and Apache Software Foundation