Summary: This document provides basic information about the extension providing Apache Struts support for the JEE Analyzer.
This extension provides support for Apache Struts - this support is in addition to the basic support provided for Apache Struts in the JEE Analyzer. The extension's main role is to improve the detection of links and transaction computations where Apache Struts is implicated.
- At the current time, analysis results will contain duplicated objects: the Struts Operation object (created by the extension) corresponds to the Struts Action Mapping Operation object created by the JEE Analyzer - this duplication will be fixed in a future release.
- All Quality Rule results involving Apache Struts code are generated using the JEE Analyzer and not the Apache Struts extension.
- All Transaction results involving Apache Struts code are generated using the Struts Operation object (created by the extension) and not the Struts Action Mapping Operation object created by the JEE Analyzer.
In what situation should you install this extension?
If your JEE application source code uses the Apache Struts framework you should install this extension to benefit from improved support for Apache Struts.
Object structure and links
- Creates Struts Operations which represent entry-points for web services. For each operation, one Struts Operation object is created.
- The dependent Web Services Linker is responsible for detecting and creating links between the UI (JSP/HTML etc) to the Struts Operation object created by the extension.
Struts 1.1 support
In the "web.xml" file, the extension will detect the servlet pointing to "org.apache.struts.action.ActionServlet" class, indicating that Struts 1.1 is being used. The extension will detect the servlet mapping (i.e. "*.perform" in the example below):
In the struts config xml files (struts-XXX.xml), the extension will detect the correspondence between a URL and a java class (i.e. /logout corresponds to the "com.company.lightspeed.struts.logon.StrutsActionLogout" java class):
The extension will search for all java classes which inherit directly or not from the "org.apache.struts.action.Action" class and will then search for the "execute" method in the class hierarchy.
The StrutsActionLogout class seen in the struts web.xml file is shown.
All request from clients whose URL is "logout.perform" will call the "execute" method. But, in many cases, this method is higher up in the hierarchy, and as such, the extension will analyze this method to see if a method of the subclass (here StrutsActionLogout) is called from "execute". In the above example, this is the case, "execute" calls "executeExtended" which is in the subclass. In this case, we create a Struts Operation named "/logout" (name found in the Struts xml file) and a call link between the operation and the "executeExtended" method.
Struts 2.x support
In the "web.xml" file, the extension will detect the filter pointing to "org.apache.struts2.dispatcher.FilterDispatcher" class, indicating that Struts 2.x is being used. The extension will detect the servlet mapping (i.e. "*.action;/*" in the example below). The extension will also obtain the filter "struts2" and "BaseStrutsFilter" because "BaseStrutsFilter" points to a class which exists in the analysis.
If a struts config file exists as shown below, the extension can obtain a correspondence between the path and a java class: in the example below, name="Login" gives the name of the operation that will be created:
Classes with @Results annotation
The extension will search for all java classes using the "@Results" annotation which is resolved to "org.apache.struts2.config.Results".
The extension will then search for all methods which are public and have "String" as the return type. The extension will create a Struts Operation with the name "/Restringe!carregarRegistro" (Restringe is the class name without the ending "Action"), and a call link to the method.
Classes implementing SessionAware
The extension will search for all java classes implementing "org.apache.struts2.interceptor.SessionAware".
The extension will create a Struts Operation with the name "/Login" (this name is found in a struts xml config file, or the class name by default), and a call link to the "execute" method.
Classes inheriting from com.opensymphony.xwork2.ActionSupport
The extension will search for all java classes implementing "com.opensymphony.xwork2.ActionSupport".
The extension will create a Struts Operation with the name "/ManageFieldsPV" (this name is found in the class name without the Action part), and a call link to the "execute" method.
Classes inheriting from org.apache.struts.actions.DispatchAction
The extension will search for all java classes implementing "org.apache.struts.actions.DispatchAction".
We create a Struts Operation with the name "/BookEdit?do=editBook" (this name is found in the struts web xml file or, by default, is the class name without the Action part), and a call link to the "editBook" method. The "do" after the "?" is found in the struts web xml file in the "parameter" field of the "action" tag. The same is done for every method of the class.
Example of a struts-config.xml:
Supported Apache Struts versions
Supported client frameworks
- Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
- Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
|Quality and Sizing|
CAST AIP release
|7.3.4 and all higher 7.3.x releases|
Supported DBMS servers
This extension is compatible with the following DBMS servers:
|CAST AIP release||CSS||Oracle||Microsoft|
|All supported releases|
|An installation of any compatible release of CAST AIP (see table above)|
Dependencies with other extensions
Some CAST extensions require the presence of other CAST extensions in order to function correctly. The Apache Struts extension requires that the following other CAST extensions are also installed:
- JEE Analyzer
- Web Services Linker
- com.castsoftware.internal.platform (internal extension)
- when using the CAST Extension Downloader to download the extension and the Manage Extensions interface in CAST Server Manager to install the extension, any dependent extensions are automatically downloaded and installed for you. You do not need to do anything.
- the JEE Analyzer is not a dependency, but since this extension is always installed with AIP, you do not need to do anything.
Download and installation instructions
The latest release status of this extension can be seen when downloading it from the CAST Extend server.
CAST Transaction Configuration Center (TCC) setup
If you are using the extension with CAST AIP ≥ 8.3.x, an Apache Struts specific setup is automatically imported when the extension is installed. These items will be available in the CAST Transaction Configuration Center:
Manual import action for CAST AIP ≤ 8.2.x
If you are using the extensions with CAST AIP ≤ 8.2.x, you can manually import the TCC setup, should you want to:
- Locate the .TCCSetup file in the extension folder: Configuration\TCC\Base_Java_Struts.TCCSetup
- In the CAST Transaction Configuration Center, ensure you have selected the Templates node:
- This .TCCSetup file is to be imported into the CAST Transaction Calibration Center using either the:
- File > Import Configuration menu option:
- Or right clicking on the Template node and selecting Import Configuration:
- The import of the "Base_Java_Struts.TCCSetup" file will provide you with a sample Transaction Entry point in the Free Definition node under Templates:
- Now right click the "Standard Entry Point" item and select copy:
- Paste the item into the equivalent node under the Application, for example, below we have copied it into the Application MEUDON:
- Repeat for any additional items or generic sets that have been imported from the .TCCSetup file.
Packaging, delivering and analyzing your source code
Once the extension is installed, no further configuration changes are required before you can package your source code and run an analysis. The process of packaging, delivering and analyzing your source code does not change in any way:
- Package and deliver your application in the exact same way as you always have. You can refer to the existing official CAST AIP documentation for more information about this - see: .
- Analyze your delivered application source code in the CAST Management Studio in the exact same way as you always have. You can refer to the existing official CAST AIP documentation for more information about configuring an analysis - see: Analysis Configuration and Execution
What results can you expect?
The following objects are displayed in CAST Enlighten: