List of usage examples for org.springframework.web.context.support AnnotationConfigWebApplicationContext setDisplayName
public void setDisplayName(String displayName)
From source file:br.com.joaops.awc.AwcApplicationInitializer.java
private AnnotationConfigWebApplicationContext getContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setDisplayName(APPLICATION_NAME); context.setConfigLocation(CONFIG_LOCATION); return context; }
From source file:org.davidmendoza.demo.config.StartUpConfig.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.register(ComponentConfig.class, DataConfig.class, MailConfig.class, WebConfig.class); context.setDisplayName("DemoApp"); FilterRegistration.Dynamic sitemeshFilter = servletContext.addFilter("sitemeshFilter", new ConfigurableSiteMeshFilter()); sitemeshFilter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); FilterRegistration.Dynamic characterEncodingFilter = servletContext.addFilter("characterEncodingFilter", new CharacterEncodingFilter()); characterEncodingFilter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); characterEncodingFilter.setInitParameter("encoding", "UTF-8"); characterEncodingFilter.setInitParameter("forceEncoding", "true"); servletContext.addListener(new ContextLoaderListener(context)); //servletContext.setInitParameter("defaultHtmlEscape", "false"); DispatcherServlet servlet = new DispatcherServlet(); // no explicit configuration reference here: everything is configured in the root container for simplicity servlet.setContextConfigLocation(""); ServletRegistration.Dynamic appServlet = servletContext.addServlet("appServlet", servlet); appServlet.setLoadOnStartup(1);/*from ww w. j av a 2s . c om*/ appServlet.setAsyncSupported(true); Set<String> mappingConflicts = appServlet.addMapping("/"); if (!mappingConflicts.isEmpty()) { throw new IllegalStateException("'appServlet' cannot be mapped to '/' under Tomcat versions <= 7.0.14"); } }
From source file:org.lightadmin.logging.configurer.LightConfigurerWebApplicationInitializer.java
private AnnotationConfigWebApplicationContext createApplicationContext() { AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext(); webApplicationContext.register(configurations()); webApplicationContext.setDisplayName("LightConfigurer WebApplicationContext"); webApplicationContext.setNamespace("light-configurer"); return webApplicationContext; }
From source file:net.przemkovv.sphinx.config.ApplicationInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(ApplicationConfig.class, JpaConfig.class); // rootContext.refresh(); rootContext.setDisplayName("Sphinx Web Application"); servletContext.addListener(new ContextLoaderListener(rootContext)); // servletContext.addListener(new HttpSessionEventPublisher()); AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(WebMvcConfig.class); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("Spring MVC Servlet", new DispatcherServlet(dispatcherContext)); dispatcher.addMapping("/app/"); dispatcher.setLoadOnStartup(1);// ww w. j a v a2 s . c o m // servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain")) // .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*"); servletContext.addFilter("UrlRewriteFilter", new UrlRewriteFilter()).addMappingForUrlPatterns(null, true, "/*"); servletContext.addFilter("HttpMethodFilter", new HiddenHttpMethodFilter()).addMappingForUrlPatterns(null, true, "/*"); servletContext.addFilter("HttpPutFormContentFilter", new HttpPutFormContentFilter()) .addMappingForUrlPatterns(null, true, "/*"); FilterRegistration.Dynamic charsetFilter = servletContext.addFilter("charsetFilter", new CharacterEncodingFilter()); charsetFilter.setInitParameter("encoding", "UTF-8"); charsetFilter.setInitParameter("forceEncoding", "true"); charsetFilter.addMappingForUrlPatterns(null, true, "/*"); FilterRegistration.Dynamic dustCompilingFilter = servletContext.addFilter("dustCompilingFilter", new DustCompilingFilter()); dustCompilingFilter.setInitParameter("templateNameRegex", "/template/(.*).dust.js$"); dustCompilingFilter.addMappingForUrlPatterns(null, true, "/*"); }
From source file:com.kixeye.chassis.transport.http.HttpTransportConfiguration.java
@Bean(name = HTTP_TRANSPORT_CHILD_CONTEXT_BEAN_NAME) public SpringContextWrapper transportWebMvcContext(ConfigurableWebApplicationContext parentContext, ServletContextHandler servletContextHandler) { AnnotationConfigWebApplicationContext transportWebMvcContext = new AnnotationConfigWebApplicationContext(); transportWebMvcContext.setDisplayName("httpTransport-webMvcContext"); transportWebMvcContext.setServletContext(servletContextHandler.getServletContext()); transportWebMvcContext.setParent(parentContext); transportWebMvcContext.setEnvironment(parentContext.getEnvironment()); transportWebMvcContext.register(SpringMvcConfiguration.class); transportWebMvcContext.register(PropertySourcesPlaceholderConfigurer.class); transportWebMvcContext.refresh();//from ww w. j a v a 2 s . c o m return new SpringContextWrapper(transportWebMvcContext); }
From source file:org.lightadmin.core.config.LightAdminWebApplicationInitializer.java
private AnnotationConfigWebApplicationContext lightAdminApplicationContext( final ServletContext servletContext) { AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext(); String basePackage = configurationsBasePackage(servletContext); webApplicationContext.register(configurations(servletContext)); webApplicationContext.addBeanFactoryPostProcessor( new LightAdminBeanDefinitionRegistryPostProcessor(basePackage, servletContext)); webApplicationContext.setDisplayName("LightAdmin WebApplicationContext"); webApplicationContext.setNamespace("lightadmin"); return webApplicationContext; }