List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:edu.stanford.epad.epadws.listener.StartupListener.java
public void contextInitialized(ServletContextEvent event) { // Skip, if we are using same APP if (!Main.separateWebServicesApp) return;/*from www. java 2 s . c o m*/ log.info("#####################################################"); log.info("############# Starting ePAD Web Service #############"); log.info("#####################################################"); // call Spring's context ContextLoaderListener to initialize // all the context files specified in web.xml super.contextInitialized(event); ServletContext servletContext = event.getServletContext(); appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); webAppPath = servletContext.getRealPath("/"); try { URL url = servletContext.getResource("/"); webAppURL = "http:/" + url.getPath(); // Does not look correct System.out.println("Context initialized , webAppUrl=" + webAppURL + " webappPath=" + webAppPath); } catch (Exception x) { } Main.checkPropertiesFile(); Main.checkResourcesFolders(); Main.checkPluginsFile(); RemotePACService.checkPropertiesFile(); Main.initializePlugins(); Main.startSupportThreads(); Main.loadPluginClasses(); new ServerStatusHandler(); // Sets startup time }
From source file:org.lamsfoundation.lams.admin.web.ToolContentListAction.java
private DataSource getDataSource() { if (ToolContentListAction.dataSource == null) { WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(getServlet().getServletContext()); ToolContentListAction.dataSource = (DataSource) ctx.getBean("dataSource"); }// w w w. ja v a2 s .c o m return ToolContentListAction.dataSource; }
From source file:com.edgenius.wiki.webapp.servlet.UploadServlet.java
private MessageService getMessageService() { ServletContext context = this.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); return (MessageService) ctx.getBean(MessageService.SERVICE_NAME); }
From source file:com.edgenius.wiki.webapp.servlet.DownloadServlet.java
private void initServiceBean() { ServletContext context = this.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); userReadingService = (UserReadingService) ctx.getBean(UserReadingService.SERVICE_NAME); securityService = (SecurityService) ctx.getBean(SecurityService.SERVICE_NAME); repoService = (RepositoryService) ctx.getBean(RepositoryService.SERVICE_NAME); themeService = (ThemeService) ctx.getBean(ThemeService.SERVICE_NAME); ;/* ww w. java 2 s . c o m*/ spaceService = (SpaceService) ctx.getBean(SpaceService.SERVICE_NAME); ; exportService = (ExportService) ctx.getBean(ExportService.SERVICE_NAME); ; messageService = (MessageService) ctx.getBean(MessageService.SERVICE_NAME); ; }
From source file:cn.bc.web.util.WebUtils.java
/** * ? WebApplicationContext //from w ww . ja v a 2 s . c o m * * @return */ public static synchronized WebApplicationContext getWac() { if (null == wac) wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); return wac; }
From source file:com.edgenius.wiki.webapp.servlet.UploadServlet.java
private UserReadingService getUserReadingService() { ServletContext context = this.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); return (UserReadingService) ctx.getBean(UserReadingService.SERVICE_NAME); }
From source file:com.edgenius.wiki.webapp.servlet.UploadServlet.java
private PageService getPageService() { ServletContext context = this.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); return (PageService) ctx.getBean(PageService.SERVICE_NAME); }
From source file:com.edgenius.wiki.webapp.servlet.UploadServlet.java
private ActivityLogService getActivityLog() { ServletContext context = this.getServletContext(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); return (ActivityLogService) ctx.getBean(ActivityLogService.SERVICE_NAME); }
From source file:org.fao.fenix.wds.web.rest.WDSRESTService.java
public String formatOutput(List<List<String>> table, String filename) { String output = ""; ServletContext servletContext = this.getServletConfig().getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); Wrapper wrapper = (Wrapper) wac.getBean("wrapper"); WrapperConfigurations c = new WrapperConfigurations(fwds.getCss()); switch (fwds.getOutput()) { case HTML: output = wrapper.wrapAsHTML(table, true, c).toString(); break;// w ww . ja v a 2 s . co m case JSON: output = Wrapper.wrapAsJSON(table).toString(); break; case OLAPJSON: // output = OLAPWrapper.wrapAsOLAPJSON(table, fwds.isShowNullValues(), fwds.isAddFlags()).toString(); output = OLAPWrapper.gsonWrapper(table).toString(); break; case CSV: output = wrapper.wrapAsCSV(table, c).toString(); break; case EXCEL: filename += ".xls"; output = wrapper.wrapAsExcel(table, filename).toString(); break; case XML2: output = Wrapper.wrapAsXML2(table).toString(); break; default: output = Wrapper.wrapAsXML(table).toString(); break; } return output; }
From source file:ch.gadp.alfresco.OAuthSSOAuthenticationFilter.java
/** * Retrieves the root application context * * @return application context */ private ApplicationContext getApplicationContext() { return WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); }