/** ? ? ? ? * Return the delegate Action for the given mapping. ? ? ? ? * <p>The default implementation determines a bean name from the ? ? ? ? * given ActionMapping and looks up the corresponding bean in the ? ? ? ? * WebApplicationContext. ? ? ? ? * @param mapping the Struts ActionMapping ? ? ? ? * @return the delegate Action ? ? ? ? * @throws BeansException if thrown by WebApplicationContext methods ? ? ? ? * @see #determineActionBeanName ? ? ? ? */
? ? ? ? protectedAction getDelegateAction(ActionMapping mapping)throws BeansException { ? ? ? ? ? ? ? ? WebApplicationContext wac = getWebApplicationContext(getServlet(), mapping.getModuleConfig()); ? ? ? ? ? ? ? ? String beanName = determineActionBeanName(mapping); ? ? ? ? ? ? ? ? return(Action) wac.getBean(beanName, Action.class); ? ? ? ? }
? ? ? ? /** ? ? ? ? * Fetch ContextLoaderPlugIn's WebApplicationContext from the ? ? ? ? * ServletContext, containing the Struts Action beans to delegate to. ? ? ? ? * @param actionServlet the associated ActionServlet ? ? ? ? * @param moduleConfig the associated ModuleConfig ? ? ? ? * @return the WebApplicationContext ? ? ? ? * @throws IllegalStateException if no WebApplicationContext could be found ? ? ? ? * @see DelegatingActionUtils#getRequiredWebApplicationContext ? ? ? ? * @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX ? ? ? ? */ ? ? ? ? protected WebApplicationContext getWebApplicationContext( ? ? ? ? ? ? ? ? ? ? ? ? ActionServlet actionServlet, ModuleConfig moduleConfig)throwsIllegalStateException{ ? ? ? ? ? ? ? ? return DelegatingActionUtils.getRequiredWebApplicationContext(actionServlet, moduleConfig); ? ? ? ? }
|