org.apache.struts.tiles
Class TilesRequestProcessor

java.lang.Object
  |
  +--org.apache.struts.action.RequestProcessor
        |
        +--org.apache.struts.tiles.TilesRequestProcessor

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

RequestProcessor contains the processing logic that the Struts controller servlet performs as it receives each servlet request from the container.

This processor subclass the Struts one in order to intercept calls to forward or include. When such call is done, Tiles processor check if the specified uri is a definition name. If true, the definition is retrieved and included. If false, the original uri is included or a forward is performed.

Actually, catching is done by overloading following methods:

Since:
Tiles 1.1.1
Author:
Cedric Dumoulin

Field Summary
private  DefinitionsFactory definitionsFactory
          Definitions factory
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
 
Fields inherited from class org.apache.struts.action.RequestProcessor
actions, appConfig, INCLUDE_PATH_INFO, INCLUDE_SERVLET_PATH, servlet
 
Constructor Summary
TilesRequestProcessor()
           
 
Method Summary
protected  void doForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Do a forward using request dispatcher.
 DefinitionsFactory getDefinitionsFactory()
          Get associated definition factory.
 void init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ApplicationConfig appConfig)
          Initialize this request processor instance.
protected  void initDefinitionsMapping()
          Read component instance mapping configuration file.
protected  void internalModuleRelativeForward(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Catch the call to a module relative forward.
protected  void internalModuleRelativeInclude(java.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Do a module relative include to specified uri using request dispatcher.
protected  void processForwardConfig(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.config.ForwardConfig forward)
          Overloaded method from Struts RequestProcessor.
protected  boolean processTilesDefinition(java.lang.String definitionName, boolean contextRelative, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process a Tile definition name.
 
Methods inherited from class org.apache.struts.action.RequestProcessor
destroy, doInclude, getDebug, getInternal, getServletContext, log, log, process, processActionCreate, processActionForm, processActionForward, processActionPerform, 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
 

Field Detail

definitionsFactory

private DefinitionsFactory definitionsFactory
Definitions factory


log

protected static org.apache.commons.logging.Log log
Commons Logging instance.

Constructor Detail

TilesRequestProcessor

public TilesRequestProcessor()
Method Detail

init

public void init(org.apache.struts.action.ActionServlet servlet,
                 org.apache.struts.config.ApplicationConfig appConfig)
          throws javax.servlet.ServletException
Initialize this request processor instance.

Overrides:
init in class org.apache.struts.action.RequestProcessor
Parameters:
servlet - The ActionServlet we are associated with
appConfig - The ApplicationConfig we are associated with.
Throws:
javax.servlet.ServletException - If an error occur during initialization

initDefinitionsMapping

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

javax.servlet.ServletException

processTilesDefinition

protected boolean processTilesDefinition(java.lang.String definitionName,
                                         boolean contextRelative,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws java.io.IOException,
                                         javax.servlet.ServletException
Process a Tile definition name. This method try to process parameter definitionName as a definition name. It return true if a definition has been processed, false otherwise. Parameter contextRelative is not use in this implementation.

Parameters:
definitionName - Definition name to insert.
contextRelative - Does the Definition is marked contextRelative ?
request - Current page request
response - Current page response
Returns:
True if the method has process uri as a definition name, false otherwise.
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 using request dispatcher. Uri is a valid uri. If response has already been commited, do an include instead.

Overrides:
doForward in class org.apache.struts.action.RequestProcessor
Parameters:
uri - Uri or Definition name to forward
request - Current page request
response - Current page response
java.io.IOException
javax.servlet.ServletException

processForwardConfig

protected void processForwardConfig(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    org.apache.struts.config.ForwardConfig forward)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Overloaded method from Struts RequestProcessor. Forward or redirect to the specified destination, by the specified mechanism. This method catch the struts actionForward call. It checks if the actionForward is done on a Tiles definition name. If true, process the definition, and insert it. If false, call the original parent's method.

Overrides:
processForwardConfig in class org.apache.struts.action.RequestProcessor
Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
forward - The ActionForward controlling where we go next
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

internalModuleRelativeForward

protected void internalModuleRelativeForward(java.lang.String uri,
                                             javax.servlet.http.HttpServletRequest request,
                                             javax.servlet.http.HttpServletResponse response)
                                      throws java.io.IOException,
                                             javax.servlet.ServletException
Catch the call to a module relative forward. If the specified uri is a tiles definition name, insert it. Otherwise, parent processing is called Do a module relative forward to specified uri using request dispatcher. Uri is relative to the current module. The real uri is compute by prefixing the module name. This method is used internally and i part othe cublic void APIhecksisonFdviche cue in thisanceass the SP>
<>Overrides:
init(javin class org.apache.struts.action.RequestProcessor
Parameters:
uri - Uri orRelati-ve to theURIrward
request - Current page request
response - Current page response
java.io.IOException
javax.servlet.ServletException
Since:
Tiles RequesD>

i>

internalModuleRelativeForwarePRE> protected void internalModuleRelativeForwarea.lang.String uri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) java.io.IOException, javax.servlet.ServletException
Catch odule relative include to specified uri using request dispatcher. relative to the current module. The real uri is compute by prefixing the module name. This method is used internally and i part othe cublic void APIhecksisonFdviche cue in thisanceass the SP>
<>Overrides:
initin class org.apache.struts.action.RequestProcessor
Parameters:
uri - Uri orRelati-ve to theURIrward
request - Current page request
response - Current page response
java.io.IOException
javax.servlet.ServletException
Since:
Tiles RequesD>

getDefi>

interninitionsFactoryPRE> public Tile="../../../../org/apache/struts/tiles/DefinitionsFactory.html">DefinitionsFactory definiinitionsFactoryPRE>
/DLsociated definition factory.
<>

======= CONSTR NAVBARDATA ======== -->


0--> Astrut SoftweatiFound by tBLE>GCOLABLE>