List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:org.openxdata.server.servlet.DataImportServlet.java
@Override public void init() throws ServletException { ServletContext sctx = this.getServletContext(); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sctx); // Manual Injection userService = (UserService) ctx.getBean("userService"); userDetailsService = (UserDetailsService) ctx.getBean("userDetailsService"); formDownloadService = (FormDownloadService) ctx.getBean("formDownloadService"); authenticationService = (AuthenticationService) ctx.getBean("authenticationService"); }
From source file:org.hdiv.filter.ValidatorFilter.java
/** * Init required dependencies//w w w . ja v a 2 s . com */ protected void initDependencies() { if (this.hdivConfig == null) { ServletContext servletContext = getServletContext(); WebApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); this.hdivConfig = (HDIVConfig) context.getBean("config"); this.validationHelper = (IValidationHelper) context.getBean("validatorHelper"); if (context.containsBean("multipartConfig")) { // For applications without Multipart requests this.multipartConfig = (IMultipartConfig) context.getBean("multipartConfig"); } this.errorHandler = (ValidatorErrorHandler) context.getBean("validatorErrorHandler"); } }
From source file:org.openxdata.server.servlet.MultimediaServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); ServletContext sctx = this.getServletContext(); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sctx); studyManagerService = (StudyManagerService) ctx.getBean("studyManagerService"); }
From source file:org.jessma.ext.spring.SpringInjectFilter.java
@Override public void init() { servletContext = HttpHelper.getServletContext(); springMap = new HashMap<CoupleKey<Class<?>, Method>, SpringAttr[]>(); context = WebApplicationContextUtils.getWebApplicationContext(servletContext); if (context == null) { listener = new ContextLoaderListener(); listener.contextInitialized(new ServletContextEvent(servletContext)); context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); }//from ww w .j a va2s .co m }
From source file:org.efs.openreports.util.displaytag.SpringDecoratorFactory.java
@Override public TableDecorator loadTableDecorator(PageContext pageContext, String name) throws DecoratorInstantiationException { if (StringUtils.isBlank(name)) return null; ApplicationContext appContext = WebApplicationContextUtils .getRequiredWebApplicationContext(pageContext.getServletContext()); Object decorator = null;/*from w w w .jav a 2s .c om*/ try { decorator = appContext.getBean(name, TableDecorator.class); } catch (NoSuchBeanDefinitionException e) { log.debug("Decorator " + name + " not found in Spring ApplicationContext. Using DefaultDecoratorFactory.loadTableDecorator. "); } if (decorator != null && decorator instanceof TableDecorator) return (TableDecorator) decorator; return super.loadTableDecorator(pageContext, name); }
From source file:org.osmsurround.tags.NodeEditLinksTag.java
@Override public void setPageContext(PageContext pageContext) { super.setPageContext(pageContext); applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(pageContext.getServletContext()); }
From source file:nl.tue.gale.tools.servlets.ExportFile.java
private boolean copyToConfig(String file, String app) { try {/*from w ww.jav a2 s. com*/ ApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); DMCache cache = (DMCache) applicationContext.getBean("dmCache"); CacheSession<Concept> session = cache.openSession(); for (Concept c : AHA3Format.convertStream(new FileInputStream(new File(file)))) session.put(c.getUri(), c); session.commit(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
From source file:org.malaguna.cmdit.bbeans.AbstractBean.java
/** * Resuelve dinmicamente el ServiceDelegate *///from w ww .j a v a 2s. c o m public AbstractBean() { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); super.setService((ServiceDelegate) wac.getBean(BeanNames.SERVICE)); }
From source file:kz.supershiny.web.wicket.TiresApplication.java
@Override public Session newSession(Request request, Response response) { ApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); UserService userService = applicationContext.getBean(UserService.class); userService.countSession();/*from w w w . jav a2 s. c o m*/ return new TiresSession(request); }