List of usage examples for javax.servlet ServletRegistration setInitParameter
public boolean setInitParameter(String name, String value);
From source file:com.dm.platform.listener.base.MyServletContextListener.java
@Override public void contextInitialized(ServletContextEvent sce) { System.out.println("MyServletContextListener"); ServletContext sc = sce.getServletContext(); ServletRegistration sr = sc.addServlet("spring", DispatcherServlet.class); sr.setInitParameter("contextConfigLocation", "/WEB-INF/dispatcher-servlet.xml"); sr.addMapping("/spring/*"); FilterRegistration fr = sc.addFilter(DynamicRegistFilter.class.getSimpleName(), DynamicRegistFilter.class); fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/platform/*"); // fr = sc.addFilter(DelegatingFilterProxy.class.getSimpleName(), DelegatingFilterProxy.class); // fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/platform/*"); sc.addListener(new ContextLoaderListener()); }
From source file:com.dm.platform.listener.PlatformServletContextListener.java
@Override public void contextInitialized(ServletContextEvent sce) { System.out.println("contextInitialized"); ServletContext sc = sce.getServletContext(); sc.setInitParameter("contextConfigLocation", "/WEB-INF/applicationContext.xml"); // sc.addListener(ContextLoaderListener.class); FilterRegistration fr = sc.addFilter(DelegatingFilterProxy.class.getSimpleName(), DelegatingFilterProxy.class); fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/spring/*"); ServletRegistration sr = sc.addServlet("spring", DispatcherServlet.class); sr.setInitParameter("contextConfigLocation", "/WEB-INF/dispatcher-servlet.xml /WEB-INF/platform-security.xml"); sr.addMapping("/spring/*"); fr = sc.addFilter(DynamicRegistFilter.class.getSimpleName(), DynamicRegistFilter.class); fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/platform/*"); }
From source file:org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.java
@Override public void setServletContext(ServletContext servletContext) { String servletRegistrationName = getServletRegistrationName(); ServletRegistration registration = servletContext.getServletRegistration(servletRegistrationName); if (registration != null) { if (logger.isInfoEnabled()) { logger.info(/* w ww . j a v a2 s. c o m*/ "Configuring existing registration for Jersey servlet '" + servletRegistrationName + "'"); } registration.setInitParameters(this.jersey.getInit()); registration.setInitParameter(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, Boolean.TRUE.toString()); } }