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 void destroy() { WebContext webcx = WebContextFactory.get(); for(Creator c : creators.values()) { if (c.getScope().equals(Creator.APPLICATION)) { Object creatorInstance = webcx.getServletContext().getAttribute(c.getJavascript()); if (creatorInstance instanceof UninitializingBean) { ((UninitializingBean) creatorInstance).destroy(); } } } }
ServletContext sc = WebContextFactory.get().getServletContext(); try
ServletContext threadServletContext = webContext.getServletContext(); welcomeFiles = getWebXmlWelcomeFileList(threadServletContext);
public Object convertInbound(Class<?> paramType, InboundVariable data) { WebContext webcx = WebContextFactory.get(); if (HttpServletRequest.class.isAssignableFrom(paramType)) { return webcx.getHttpServletRequest(); } if (HttpServletResponse.class.isAssignableFrom(paramType)) { return webcx.getHttpServletResponse(); } if (ServletConfig.class.isAssignableFrom(paramType)) { return webcx.getServletConfig(); } if (ServletContext.class.isAssignableFrom(paramType)) { return webcx.getServletContext(); } if (HttpSession.class.isAssignableFrom(paramType)) { return webcx.getSession(true); } return null; }
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); } }
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 EntityDWR(){ WebContext ctx = WebContextFactory.get(); ServletContext sc= ctx.getServletContext(); entityWADao = ModelAccess.on(sc).getWebappDaoFactory().getIndividualDao(); }
String moduleName = (String) getModuleNameMethod.invoke(utils, "/", wc.getServletContext()); moduleConfig = (ModuleConfig) getModuleConfigMethod.invoke(utils, moduleName, wc.getServletContext()); moduleConfig = RequestUtils.getModuleConfig(request, wc.getServletContext());
object = webcx.getServletContext().getAttribute(name); webcx.getServletContext().setAttribute(name, object);
if (webcx != null) return webcx.getServletContext();
ServletContext context = WebContextFactory.get().getServletContext(); Session session = H3SessionAjaxFilter.getCurrentSession(context);