List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:com.bt.aloha.batchtest.ultramonkey.Servlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); WebApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletConfig.getServletContext()); service = (Service) applicationContext.getBean("serviceBean"); // check for a system property to set the Stack contact address if (null != System.getProperty("sip.stack.contact.address", null)) { SimpleSipStack simpleSipStack = (SimpleSipStack) applicationContext.getBean("simpleSipStack"); simpleSipStack.setContactAddress(System.getProperty("sip.stack.contact.address")); }//from w w w. java 2s . c o m }
From source file:org.openxdata.server.servlet.WMDownloadServlet.java
@Override public void init() throws ServletException { ServletContext sctx = this.getServletContext(); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sctx); formDownloadService = (FormDownloadService) ctx.getBean("formDownloadService"); }
From source file:com.cubusmail.server.services.CubusStartupListener.java
public void contextInitialized(ServletContextEvent servletcontextevent) { WebApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(servletcontextevent.getServletContext()); try {/*w w w.j a v a2 s . c om*/ DBManager dbManager = context.getBean(DBManager.class); dbManager.initInternalDB(); } catch (Exception e) { log.fatal(e.getMessage(), e); throw new IllegalStateException("Could not initialize internal database!"); } try { URL test = CubusStartupListener.class.getClassLoader() .getResource(CubusConstants.LOGIN_MODULE_CONFIG_FILE); System.setProperty(CubusConstants.JAAS_PROPERTY_NANE, test.getFile()); } catch (Exception e) { log.fatal(e.getMessage(), e); throw new IllegalStateException("Could not load " + CubusConstants.LOGIN_MODULE_CONFIG_FILE); } }
From source file:com.nkapps.billing.webservices.AccountWebService.java
private Object getBean(String beanName) { ServletContext servletContext = (ServletContext) context.getMessageContext() .get("javax.xml.ws.servlet.context"); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); return webApplicationContext.getAutowireCapableBeanFactory().getBean(beanName); }
From source file:org.apache.servicemix.http.HttpManagedServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); // Retrieve spring application context ApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); // Retrieve/*from ww w . j a v a2 s . c om*/ String containerName = config.getInitParameter(CONTAINER_PROPERTY); if (containerName == null) { containerName = CONTAINER_DEFAULT; } JBIContainer container = (JBIContainer) applicationContext.getBean(containerName); if (container == null) { throw new IllegalStateException("Unable to find jbi container " + containerName); } String componentName = config.getInitParameter(COMPONENT_PROPERTY); if (componentName == null) { componentName = COMPONENT_DEFAULT; } ComponentMBeanImpl componentMBean = container.getComponent(componentName); if (componentMBean == null) { throw new IllegalStateException("Unable to find component " + componentName); } HttpComponent component = (HttpComponent) componentMBean.getComponent(); String mapping = config.getInitParameter(MAPPING_PROPERTY); if (mapping != null) { component.getConfiguration().setMapping(mapping); } processor = component.getMainProcessor(); }
From source file:it.geosolutions.opensdi2.servlet.RestFacade.java
/** * Initialize the <code>ProxyServlet</code> * /*w ww. j a v a2 s . co m*/ * @param servletConfig The Servlet configuration passed in by the servlet conatiner */ public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); if (this.urlFacade == null) { ServletContext context = getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(context); urlFacade = (URLFacade) wac.getBean("urlFacade"); } }
From source file:org.openxdata.server.servlet.ImportServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); ServletContext sctx = this.getServletContext(); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sctx); userService = (UserService) ctx.getBean("userService"); }
From source file:org.wte4j.ui.server.filters.SessionContextFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { serviceContext = WebApplicationContextUtils .getRequiredWebApplicationContext(filterConfig.getServletContext()).getBean(ServiceContext.class); }
From source file:com.bennavetta.appsite.serve.ResourceServlet.java
@Override public void init() throws ServletException { WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); processor = ctx.getBean(ProcessingController.class); }
From source file:com.enonic.cms.web.webdav.SimpleDavServlet.java
private DavConfiguration getConfiguration(final ServletContext context) { final WebApplicationContext appContext = WebApplicationContextUtils .getRequiredWebApplicationContext(context); return appContext.getBean(DavConfiguration.class); }