if (locale != null) {
SimpleContextHolder.put(CapWebUtil.localeKey, locale);
} else {
SimpleContextHolder.put(CapWebUtil.localeKey, Locale.getDefault());
}
IResult result = null;
Logger pluginlogger = logger;
IRequest request = getDefaultRequest(req);
try {
request.setParameter(FormHandler.FORM_ACTION, action);
HandlerPlugin plugin = pluginMgr.getPlugin(handler);
logger.info("plugin:" + handler + " - "
+ plugin.getClass().getSimpleName() + " action:" + action);
plugin.setRequest(request);
pluginlogger = LoggerFactory.getLogger(plugin.getClass());
result = plugin.execute(request);
} catch (Exception e) {
IErrorResult errorResult = getDefaultErrorResult();
if (errorResult == null) {
result = new ErrorResult(request, e);
} else {
errorResult.putError(request, e);
result = errorResult;
}
if (e instanceof CapMessageException) {
pluginlogger.error(result.getResult().toString());
} else if (e instanceof CapException && e.getCause() != null) {
pluginlogger.error(result.getResult().toString(), e.getCause());
} else {
pluginlogger.error(result.getResult().toString(), e);
}
if (!"true".equals(request.get("iframe"))) {
resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
} finally {
result.respondResult(resp);
logger.debug("total spend time : {} ms",
(System.currentTimeMillis() - st));
if (logger.isTraceEnabled()) {
logger.trace("Response Data : " + result.getLogMessage());
}
SimpleContextHolder.resetContext();
}
}// ;