ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
BSFManager bsfManager = new BSFManager();
String scriptName = null;
try {
scriptName = parseScriptName(mapping.getParameter(), bsfManager);
} catch (Exception ex) {
LOG.error("Unable to parse " + mapping.getParameter(), ex);
throw new Exception("Unable to parse " + mapping.getParameter());
}
if (scriptName == null) {
LOG.error("No script specified in the parameter attribute");
throw new Exception("No script specified");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Executing script: " + scriptName);
}
HttpSession session = request.getSession();
ServletContext application = getServlet().getServletContext();
Script script = loadScript(scriptName, application);
bsfManager.declareBean("request", request,
HttpServletRequest.class);
bsfManager.declareBean("response", response,
HttpServletResponse.class);
if (session == null) {
LOG.debug("HTTP session is null");
} else {
bsfManager.declareBean("session", session, HttpSession.class);
}
bsfManager.declareBean("application", application,
ServletContext.class);
bsfManager.declareBean("log", LOG, Log.class);
StrutsInfo struts = new StrutsInfo(this, mapping, form,
getResources(request));
bsfManager.declareBean("struts", struts, StrutsInfo.class);
for (int x = 0; x < filters.length; x++) {
filters[x].apply(bsfManager);
}
bsfManager.exec(script.lang, script.file.getCanonicalPath(), 0, 0,
script.string);
ActionForward af = struts.getForward();
return af;
}