@ResponseBody
@RequestMapping(value = "/notifications-count", method= RequestMethod.GET)
public int getEventsCount(HttpServletRequest request, HttpServletResponse response) throws Exception {
Template tmpl = Template.getTemplate(request);
if (!tmpl.isSessionAuthorized()) {
throw new AccessViolationException("not authorized");
}
response.setHeader("Cache-control", "no-cache");
return tmpl.getCurrentUser().getUnreadEvents();