List of usage examples for org.springframework.web.context WebApplicationContext getBean
<T> T getBean(String name, Class<T> requiredType) throws BeansException;
From source file:org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.DbManagerFilter.java
protected DbManager lookupDbManager() { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); return (DbManager) wac.getBean("mongodbManager", DbManager.class); }
From source file:com.oak_yoga_studio.filters.MyFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { WebApplicationContext context = WebApplicationContextUtils .getWebApplicationContext(filterConfig.getServletContext()); userService = context.getBean("customerService", ICustomerService.class); }
From source file:com.usefullc.platform.common.filter.WebCommonFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { ServletContext servletContext = filterConfig.getServletContext(); ServeltContextManager.setServletContext(servletContext); WebApplicationContext wc = WebApplicationContextUtils.getWebApplicationContext(servletContext); try {//from ww w. j a v a 2 s . c om actionHandlerInvoke = wc.getBean("actionHandlerInvoke", ActionHandlerInvoke.class); } catch (Exception e) { actionHandlerInvoke = null; } if (actionHandlerInvoke != null) { interceptorList = actionHandlerInvoke.getInterceptorList(); canExcute = CollectionUtils.isNotEmpty(interceptorList); } }
From source file:org.beanfuse.security.monitor.OnlineUserListener.java
/** * session? ?session/* ww w .j ava 2s.c o m*/ */ public void sessionDestroyed(HttpSessionEvent event) { if (null == monitor) { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(event.getSession().getServletContext()); monitor = (SecurityMonitor) wac.getBean("securityMonitor", SecurityMonitor.class); } monitor.logout(event.getSession()); }
From source file:com.autentia.wuija.web.jsf.I18NSelectItemList.java
private MessageSourceAccessor getMsa() { final FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext == null) { // Cuando se llama a esta funcin desde los test de JUnit, no existe un FacesContext y se producir un error. // En este caso comprobamos que no existe el FacesContext y devolvemos un MessageSourceAccessor alternativo // (mock) return new MessageSourceAccessor(new MockMessageSource()); }//from ww w .jav a 2 s.co m final WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(facesContext); return (MessageSourceAccessor) wac.getBean("messageSourceAccessor", MessageSourceAccessor.class); }
From source file:com.conwet.silbops.connectors.comet.CometServlet.java
@Override protected void loadConfiguration(ServletConfig sc) throws ServletException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(sc.getServletContext()); // Adding the handler to avoid auto-detection in super.init() this.addAtmosphereHandler(this.getInitParameter("mapping"), wac.getBean("cometHandler", AtmosphereHandler.class)); super.loadConfiguration(sc); }
From source file:com.autentia.wuija.web.LocaleContextFilter.java
public void init(FilterConfig config) throws ServletException { final WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(config.getServletContext()); try {/*from w w w . j av a 2 s .c o m*/ localeResolver = (LocaleResolver) wac.getBean("localeResolver", LocaleResolver.class); log.info("LocaleResolver defined: " + localeResolver.getClass().getSimpleName()); } catch (NoSuchBeanDefinitionException e) { log.info("No LocaleResolver defined. Using " + CookieLocaleResolver.class.getSimpleName() + " by default"); localeResolver = new CookieLocaleResolver(); } }
From source file:com.jredrain.session.HttpSessionFilter.java
protected SessionStore lookSessionStore() { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); SessionStore store = wac.getBean("sessionStore", SessionStore.class); if (logger.isInfoEnabled()) { logger.info("Using '" + store.getClass().getSimpleName() + "' SessionStore for HttpSessionFilter"); }/*from w w w. j a v a 2s. c om*/ return store; }
From source file:org.cagrid.identifiers.namingauthority.impl.NamingAuthorityService.java
/** * @see Servlet#init(ServletConfig)// ww w . ja v a 2 s .co m */ public void init(ServletConfig config) throws ServletException { super.init(config); org.springframework.web.context.WebApplicationContext context = org.springframework.web.context.support.WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); this.processor = (HttpProcessor) context.getBean("httpProcessor", HttpProcessor.class); }