ignore

Configuration

Setting the Request Processor

One of the key extension point in Struts is the request processing implementation class, which by default is RequestProcessor. If Tiles is being used, then the default implementation class will be TilesRequestProcessor.

Your first action in configuring Strecks is to add a controller element to the struts-config.xml, changing the request processor implementation class to org.strecks.controller.ControllerRequestProcessor. If using Tiles, you can use the request processor implementation class org.strecks.controller.TilesControllerRequestProcessor. An example controller entry is shown below:

If you want to convert an existing application or module which is already using an extension of RequestProcessor or TilesRequestProcessor, you will need to modify this class to work with Strecks. Otherwise, no modifications to existing source code should be necessary. Existing Action and ActionForms will still work with Strecks.

<controller
	processorClass="org.strecks.controller.ControllerRequestProcessor"
	contentType="text/html;charset=utf-8" inputForward="true"
	nocache="true" />

Adding Interceptors

Adding interceptors in Strecks is straightforward. Simply add entries into strecks.properties, as shown in the example below:

before.interceptor.1=org.strecks.interceptor.ActionLoggingInterceptor
before.interceptor.2=org.strecks.interceptor.RedirectBeforeInterceptor
after.interceptor.1=org.strecks.interceptor.HistoryRecorder
after.interceptor.2=org.strecks.interceptor.ActionLoggingInterceptor

Note that the interceptors will be called in the order determined by the number part of the property name. For example, HistoryRecorder.afterExecute() will be called before ActionLoggingInterceptor.afterExecute().

The one gotcha is to make sure that the numbering is correct in following an unbroken sequence. For example, if the line after.interceptor.1=org.strecks.interceptor.HistoryRecorder is removed, then ActionLoggingInterceptor.afterExecute() will not be called. To make this configuration work, the line after.interceptor.2=org.strecks.interceptor.ActionLoggingInterceptor will need to be changed to after.interceptor.1=org.strecks.interceptor.ActionLoggingInterceptor.

SourceForge.net logo java.net Member logo Copyright © 2005-2007 Realsolve Solutions