public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { try { return chain.doFilter(obj, method, params); } catch (PermissionException e) { throw e; } catch (RTException e) { throw e; } catch (Exception e) { Throwable e2 = e; if (e2 instanceof InvocationTargetException) e2 = ((InvocationTargetException) e).getTargetException(); LOG.error("DWR invocation exception", e2); throw e; } } }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { try { Thread.sleep(delay/2); } catch (InterruptedException ex) { log.warn("Pre-exec interuption", ex); } Object reply = chain.doFilter(obj, method, params); try { Thread.sleep(delay/2); } catch (InterruptedException ex) { log.warn("Post-exec interuption", ex); } return reply; }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { try { return chain.doFilter(obj, method, params);
public Object doFilter(Object object, Method method, Object[] params, AjaxFilterChain chain) throws Exception { ServletContext context = WebContextFactory.get().getServletContext(); SessionFactory sessionFactory = (SessionFactory) context.getAttribute(ATTRIBUTE_SESSION); Transaction transaction = null; if (sessionFactory != null) { Session session = sessionFactory.getCurrentSession(); transaction = session.beginTransaction(); } else { log.error("SessionFactory not initialized for this web application. Use: H3SessionAjaxFilter.setSessionFactory(servletContext, sessionFactory);"); } Object reply = chain.doFilter(object, method, params); if (transaction != null) { transaction.commit(); } return reply; }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { WebContext webContext = WebContextFactory.get(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(webContext .getServletContext()); MessageSource messageSource = (MessageSource) wac.getBean(messageSourceKey); JstlUtils.exposeLocalizationContext(webContext.getHttpServletRequest(), messageSource); return chain.doFilter(obj, method, params); } }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { WebContext webContext = WebContextFactory.get(); if (resourceBundleDirectory != null && resourceBundleLoader == null) resourceBundleLoader = new ResourceBundleLoader(webContext.getServletContext().getRealPath( resourceBundleDirectory)); I18NUtils.prepareRequest(webContext.getHttpServletRequest(), localeResolverName, bundleBaseName, resourceBundleLoader); return chain.doFilter(obj, method, params); } }
Object reply = chain.doFilter(object, method, parameters); return reply;
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { ScriptSession session = WebContextFactory.get().getScriptSession(); Long lastAccess = (Long) session.getAttribute(ATTRIBUTE_LAST_ACTION); // Free pass in if you've not done anything so far. if (lastAccess != null) { long now = System.currentTimeMillis(); if (now > lastAccess + actionTimeoutMillis) { session.addScript(new ScriptBuffer(onTimeout)); session.invalidate(); throw new DwrConvertedException("Your session has timed out"); } } Object reply = chain.doFilter(obj, method, params); session.setAttribute(ATTRIBUTE_LAST_ACTION, System.currentTimeMillis()); return reply; }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { DwrPermission permission = method.getAnnotation(DwrPermission.class); if (permission == null) // No access if not annotated. throw new PermissionException(new TranslatableMessage("common.default", "Method " + method.getName() + " not annotated with permissions"), null); if (!permission.anonymous()) { User user = Common.getUser(); if (user == null) // Not logged in. throw new PermissionException(new TranslatableMessage("common.default", "Method " + method.getName() + " does not allow anonymous access"), null); if(!permission.custom().isEmpty()){ if(!Permissions.hasPermission(user, SystemSettingsDao.instance.getValue(permission.custom()))) throw new PermissionException(new TranslatableMessage("common.default", "Method " + method.getName() + " requires " + permission.custom() + " access"), user); } if (!Permissions.hasAdminPermission(user) && permission.admin()) throw new PermissionException(new TranslatableMessage("common.default", "Method " + method.getName() + " requires admin access"), user); } return chain.doFilter(obj, method, params); } }