throws Exception {
ExtDirectPollResponse directPollResponse = new ExtDirectPollResponse();
directPollResponse.setName(event);
MethodInfo methodInfo = MethodInfoCache.INSTANCE.get(beanName, method);
boolean streamResponse;
Class<?> jsonView = null;
if (methodInfo != null) {
streamResponse = configurationService.getConfiguration().isStreamResponse()
|| methodInfo.isStreamResponse();
try {
Object[] parameters = configurationService.getParametersResolver().prepareParameters(request, response,
locale, methodInfo);
if (configurationService.getConfiguration().isSynchronizeOnSession()
|| methodInfo.isSynchronizeOnSession()) {
HttpSession session = request.getSession(false);
if (session != null) {
Object mutex = WebUtils.getSessionMutex(session);
synchronized (mutex) {
Object result = ExtDirectSpringUtil.invoke(configurationService.getApplicationContext(),
beanName, methodInfo, parameters);
if (result instanceof ModelAndJsonView) {
ModelAndJsonView modelAndJsonView = (ModelAndJsonView) result;
directPollResponse.setData(modelAndJsonView.getModel());
jsonView = getJsonView(modelAndJsonView, methodInfo.getJsonView());
} else {
directPollResponse.setData(result);
jsonView = getJsonView(result, methodInfo.getJsonView());
}
}
} else {
Object result = ExtDirectSpringUtil.invoke(configurationService.getApplicationContext(),
beanName, methodInfo, parameters);
if (result instanceof ModelAndJsonView) {
ModelAndJsonView modelAndJsonView = (ModelAndJsonView) result;
directPollResponse.setData(modelAndJsonView.getModel());
jsonView = getJsonView(modelAndJsonView, methodInfo.getJsonView());
} else {
directPollResponse.setData(result);
jsonView = getJsonView(result, methodInfo.getJsonView());
}
}
} else {
Object result = ExtDirectSpringUtil.invoke(configurationService.getApplicationContext(), beanName,
methodInfo, parameters);
if (result instanceof ModelAndJsonView) {
ModelAndJsonView modelAndJsonView = (ModelAndJsonView) result;
directPollResponse.setData(modelAndJsonView.getModel());
jsonView = getJsonView(modelAndJsonView, methodInfo.getJsonView());
} else {
directPollResponse.setData(result);
jsonView = getJsonView(result, methodInfo.getJsonView());
}
}
} catch (Exception e) {
log.error("Error polling method '" + beanName + "." + method + "'", e.getCause() != null ? e.getCause()