org.springframework.web.struts
Class DelegatingActionUtils


public abstract class DelegatingActionUtils

Common methods for various ways to make Struts delegate to Spring-managed Actions.

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.

Author:
Juergen Hoeller
Since: 1.0.2
See Also: DelegatingActionProxy, DelegatingRequestProcessor, DelegatingTilesRequestProcessor

Method Summary
 static StringdetermineActionBeanName(ActionMapping mapping)
          Default implementation of Action bean determination, taking the mapping path and prepending the module prefix, if any.
 static WebApplicationContextgetRequiredWebApplicationContext(ActionServlet actionServlet, ModuleConfig moduleConfig)
          Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, containing the Struts Action beans to delegate to.

Method Detail

determineActionBeanName

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

getRequiredWebApplicationContext

public static WebApplicationContext getRequiredWebApplicationContext(ActionServlet actionServlet, ModuleConfig moduleConfig)
throws java.lang.IllegalStateException
Fetch ContextLoaderPlugIn's WebApplicationContext from the ServletContext, containing the Struts Action beans to delegate to.

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
Returns: the WebApplicationContext
Throws:
IllegalStateException - if no WebApplicationContext could be found
See Also:
ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX