@DefaultHandler
public Resolution execute() {
if(chartConfiguration == null) {
return forwardToPageActionNotConfigured();
}
try {
try {
Thread.currentThread().setContextClassLoader(Class.class.getClassLoader());
generateChart();
} finally {
Thread.currentThread().setContextClassLoader(JFreeChartAction.class.getClassLoader());
}
chartId = RandomUtil.createRandomId();
String actionurl = context.getActionPath();
UrlBuilder chartResolution =
new UrlBuilder(context.getLocale(), actionurl, false)
.addParameter("chartId", chartId)
.addParameter("chart", "");
String url = context.getRequest().getContextPath() + chartResolution.toString();
file = RandomUtil.getTempCodeFile(CHART_FILENAME_FORMAT, chartId);
jfreeChartInstance =
new JFreeChartInstance(chart, file, chartId, "Chart: " + chartConfiguration.getName(),
width, height, url);
} catch (Exception e) {
logger.error("Chart exception", e);
return forwardToPageActionError(e);
}
return new ForwardResolution("/m/chart/jfreechart/display.jsp");
}