public abstract class

DelegatingActionUtils

extends Object
java.lang.Object
   ↳ org.springframework.web.struts.DelegatingActionUtils

This class is deprecated.
as of Spring 3.0

Class Overview

Common methods for letting Struts Actions work with a Spring WebApplicationContext.

As everything in Struts is based on concrete inheritance, we have to provide an Action subclass (DelegatingActionProxy) and two RequestProcessor subclasses (DelegatingRequestProcessor and DelegatingTilesRequestProcessor). The only way to share common functionality is a utility class like this one.

Summary

Constants
String AUTOWIRE_BY_NAME Value of the autowire init-param that indicates autowiring by name: "byName"
String AUTOWIRE_BY_TYPE Value of the autowire init-param that indicates autowiring by type: "byType"
String PARAM_AUTOWIRE The name of the autowire init-param specified on the Struts ActionServlet: "spring.autowire"
String PARAM_DEPENDENCY_CHECK The name of the dependency check init-param specified on the Struts ActionServlet: "spring.dependencyCheck"
Public Constructors
DelegatingActionUtils()
Public Methods
static String determineActionBeanName(ActionMapping mapping)
Default implementation of Action bean determination, taking the mapping path and prepending the module prefix, if any.
static WebApplicationContext findRequiredWebApplicationContext(ActionServlet actionServlet, ModuleConfig moduleConfig)
Find most specific context available: check ContextLoaderPlugIn's WebApplicationContext first, fall back to root WebApplicationContext else.
static int getAutowireMode(ActionServlet actionServlet)
Determine the autowire mode from the "autowire" init-param of the Struts ActionServlet, falling back to "AUTOWIRE_BY_TYPE" as default.
static boolean getDependencyCheck(ActionServlet actionServlet)
Determine the dependency check to use from the "dependencyCheck" init-param of the Struts ActionServlet, falling back to no dependency check as default.
static WebApplicationContext getRequiredWebApplicationContext(ActionServlet actionServlet, ModuleConfig moduleConfig)
Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext.
static WebApplicationContext getWebApplicationContext(ActionServlet actionServlet, ModuleConfig moduleConfig)
Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String AUTOWIRE_BY_NAME

Value of the autowire init-param that indicates autowiring by name: "byName"

Constant Value: "byName"

public static final String AUTOWIRE_BY_TYPE

Value of the autowire init-param that indicates autowiring by type: "byType"

Constant Value: "byType"

public static final String PARAM_AUTOWIRE

The name of the autowire init-param specified on the Struts ActionServlet: "spring.autowire"

Constant Value: "spring.autowire"

public static final String PARAM_DEPENDENCY_CHECK

The name of the dependency check init-param specified on the Struts ActionServlet: "spring.dependencyCheck"

Constant Value: "spring.dependencyCheck"

Public Constructors

public DelegatingActionUtils ()

Public Methods

public static String determineActionBeanName (ActionMapping mapping)

Default implementation of Action bean determination, taking the mapping path and prepending the module prefix, if any.

Parameters
mapping the Struts ActionMapping
Returns
  • the name of the Action bean
See Also
  • org.apache.struts.action.ActionMapping#getPath
  • org.apache.struts.config.ModuleConfig#getPrefix

public static WebApplicationContext findRequiredWebApplicationContext (ActionServlet actionServlet, ModuleConfig moduleConfig)

Find most specific context available: check ContextLoaderPlugIn's WebApplicationContext first, fall back to root WebApplicationContext else.

When checking the ContextLoaderPlugIn context: checks for a module-specific context first, falling back to the context for the default module else.

Parameters
actionServlet the associated ActionServlet
moduleConfig the associated ModuleConfig (can be null)
Returns
  • the WebApplicationContext
Throws
IllegalStateException if no WebApplicationContext could be found

public static int getAutowireMode (ActionServlet actionServlet)

Determine the autowire mode from the "autowire" init-param of the Struts ActionServlet, falling back to "AUTOWIRE_BY_TYPE" as default.

Parameters
actionServlet the Struts ActionServlet
Returns
  • the autowire mode to use

public static boolean getDependencyCheck (ActionServlet actionServlet)

Determine the dependency check to use from the "dependencyCheck" init-param of the Struts ActionServlet, falling back to no dependency check as default.

Parameters
actionServlet the Struts ActionServlet
Returns
  • whether to enforce a dependency check or not

public static WebApplicationContext getRequiredWebApplicationContext (ActionServlet actionServlet, ModuleConfig moduleConfig)

Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext.

Checks for a module-specific context first, falling back to the context for the default module else.

Parameters
actionServlet the associated ActionServlet
moduleConfig the associated ModuleConfig (can be null)
Returns
  • the WebApplicationContext
Throws
IllegalStateException if no WebApplicationContext could be found

public static WebApplicationContext getWebApplicationContext (ActionServlet actionServlet, ModuleConfig moduleConfig)

Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext.

Checks for a module-specific context first, falling back to the context for the default module else.

Parameters
actionServlet the associated ActionServlet
moduleConfig the associated ModuleConfig (can be null)
Returns
  • the WebApplicationContext, or null if none