ActionConfig actionConfig = ctx.getActionInvocation().getProxy().getConfig();
Action action = null;
try {
action = (Action) objectFactory.buildBean(className, null);
} catch (Exception e) {
throw new StrutsException("Unable to create the legacy Struts Action", e, actionConfig);
}
// We should call setServlet() here, but let's stub that out later
Struts1Factory strutsFactory = new Struts1Factory(Dispatcher.getInstance().getConfigurationManager().getConfiguration());
ActionMapping mapping = strutsFactory.createActionMapping(actionConfig);
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
ActionForward forward = action.execute(mapping, actionForm, request, response);
ActionMessages messages = (ActionMessages) request.getAttribute(Globals.MESSAGE_KEY);
if (messages != null) {
for (Iterator i = messages.get(); i.hasNext(); ) {
ActionMessage msg = (ActionMessage) i.next();
if (msg.getValues() != null && msg.getValues().length > 0) {
addActionMessage(getText(msg.getKey(), Arrays.asList(msg.getValues())));
} else {
addActionMessage(getText(msg.getKey()));
}
}
}
if (forward instanceof WrapperActionForward || actionConfig.getResults().containsKey(forward.getName())) {
return forward.getName();
} else {
throw new StrutsException("Unable to handle action forwards that don't have an associated result", actionConfig);
}
}