List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
/** * @return/*from ww w . ja v a 2 s . c o m*/ */ private UserReadingService getUserReadingService() { if (userReadingService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); userReadingService = (UserReadingService) ctx.getBean(UserReadingService.SERVICE_NAME); } return userReadingService; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
private SpaceService getSpaceService() { if (spaceService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); spaceService = (SpaceService) ctx.getBean(SpaceService.SERVICE_NAME); }/* ww w. j av a2 s. c o m*/ return spaceService; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
/** * @return/*ww w . ja v a 2 s . c o m*/ */ private ActivityLogService getActivityLog() { if (activityLog == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); activityLog = (ActivityLogService) ctx.getBean(ActivityLogService.SERVICE_NAME); } return activityLog; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
/** * @return//from ww w .ja v a2 s. co m */ private SettingService getSettingService() { if (settingService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); settingService = (SettingService) ctx.getBean(SettingService.SERVICE_NAME); } return settingService; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
private SecurityService getSecurityService() { if (securityService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); securityService = (SecurityService) ctx.getBean(SecurityService.SERVICE_NAME); }/*from ww w .j ava 2 s. c om*/ return securityService; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
private RenderService getRenderService() { if (renderService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); renderService = (RenderService) ctx.getBean(RenderService.SERVICE_NAME); }// ww w.j av a 2 s .c o m return renderService; }
From source file:com.edgenius.wiki.ext.textnut.NutServlet.java
private PageService getPageService() { if (pageService == null) { ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); pageService = (PageService) ctx.getBean(PageService.SERVICE_NAME); }//from w w w. ja v a2 s.c o m return pageService; }
From source file:org.fao.fenix.maps.web.rest.MapsRESTService.java
private Map<String, Double> getAreas(String boundary, Map<String, Double> values) { // LOGGER.info("getAreas"); Map<String, Double> result = new HashMap<String, Double>(); ServletContext servletContext = this.getServletConfig().getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); DataServiceUtils dataServiceUtils = (DataServiceUtils) wac.getBean("dataServiceUtils"); BOUNDARIES b = BOUNDARIES.valueOf(boundary); try {/*from w ww .j a v a 2 s . c o m*/ result = dataServiceUtils.getAreas(b.getConversionTable(), b.getColumnName(), "area_dd", values); } catch (AxisFault e) { e.printStackTrace(); } // LOGGER.info("result: " + result); return result; }
From source file:org.springmodules.validation.commons.taglib.JavascriptValidatorTag.java
/** * Get the validator resources from a ValidatorFactory defined in the * web application context or one of its parent contexts. * The bean is resolved by type (org.springmodules.commons.validator.ValidatorFactory). * * @return ValidatorResources from a ValidatorFactory *//*from w w w .j ava 2 s . c o m*/ private ValidatorResources getValidatorResources() { WebApplicationContext ctx = (WebApplicationContext) pageContext.getRequest() .getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (ctx == null) { // look in main application context (i.e. applicationContext.xml) ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext()); } ValidatorFactory factory = (ValidatorFactory) BeanFactoryUtils.beanOfTypeIncludingAncestors(ctx, ValidatorFactory.class, true, true); return factory.getValidatorResources(); }
From source file:org.fao.fenix.maps.web.rest.MapsRESTService.java
private void createShadedJoinLayer(Layer joinLayer) { // create join ServletContext servletContext = this.getServletConfig().getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); JoinLayerUtils joinLayerUtils = (JoinLayerUtils) wac.getBean("joinLayerUtils"); ServletContext servletContextMap = this.getServletConfig().getServletContext(); WebApplicationContext wacMap = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContextMap); MapsConf mapsConf = (MapsConf) wacMap.getBean("mapsConf"); /** TODO: issue with the namespace: fenix, set on the configuration file?**/ String layername = joinLayer.getLayerName().replace("fenix:", ""); layername = "fenix:" + layername; joinLayer.setLayerName(layername);/*from w ww . java2s . com*/ String sldFilename = joinLayerUtils.createJoinSLD(layername, mapsConf.getStylesPath(), joinLayer.getJoinLayer(), null); joinLayer.setStyleURL(getSldURL(mapsConf.getUrl(), sldFilename)); }