Java Code Examples for javax.servlet.ServletRegistration.Dynamic#addMapping()
The following examples show how to use
javax.servlet.ServletRegistration.Dynamic#addMapping() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.googledrive", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 2
Source File: BootstrapContextListener.java From ldp4j with Apache License 2.0 | 6 votes |
private static void registerCXFServlet(ServletContext servletContext) { LOGGER.info("Registering CXF servlet..."); Dynamic dynamic = servletContext. addServlet( "LDP4jFrontendServerServlet", "org.apache.cxf.transport.servlet.CXFServlet"); dynamic.addMapping("/*"); /** See https://issues.apache.org/jira/browse/CXF-5068 */ dynamic.setInitParameter("disable-address-updates","true"); /** Required for testing */ dynamic.setInitParameter("static-welcome-file","/index.html"); dynamic.setInitParameter("static-resources-list","/index.html"); dynamic.setLoadOnStartup(1); LOGGER.info("CXF servlet registered."); }
Example 3
Source File: RestServletInjector.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public Dynamic inject(ServletContext servletContext, String urlPattern) { String[] urlPatterns = splitUrlPattern(urlPattern); if (urlPatterns.length == 0) { LOGGER.warn("urlPattern is empty, ignore register {}.", SERVLET_NAME); return null; } String listenAddress = ServletConfig.getLocalServerAddress(); if (!ServletUtils.canPublishEndpoint(listenAddress)) { LOGGER.warn("ignore register {}.", SERVLET_NAME); return null; } // dynamic deploy a servlet to handle serviceComb RESTful request Dynamic dynamic = servletContext.addServlet(SERVLET_NAME, RestServlet.class); dynamic.setAsyncSupported(true); dynamic.addMapping(urlPatterns); dynamic.setLoadOnStartup(0); LOGGER.info("RESTful servlet url pattern: {}.", Arrays.toString(urlPatterns)); return dynamic; }
Example 4
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.googledrive", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 5
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new ToolListener()); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.message.bundle.manager", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 6
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new ToolListener()); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); FilterRegistration requestFilterRegistration = servletContext.addFilter("sakai.request", RequestFilter.class); requestFilterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); requestFilterRegistration.setInitParameter(RequestFilter.CONFIG_UPLOAD_ENABLED, "true"); Dynamic servlet = servletContext.addServlet("sakai-site-group-manager", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 7
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new ToolListener()); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.datemanager", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 8
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.onedrive", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 9
Source File: WebAppConfiguration.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.setServletContext(servletContext); rootContext.register(ThymeleafConfig.class); servletContext.addListener(new ToolListener()); servletContext.addListener(new SakaiContextLoaderListener(rootContext)); servletContext.addFilter("sakai.request", RequestFilter.class) .addMappingForUrlPatterns( EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*"); Dynamic servlet = servletContext.addServlet("sakai.message.bundle.manager", new DispatcherServlet(rootContext)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 10
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 11
Source File: WebAppInitializer.java From nio-multipart with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setConfigLocation("org.synchronoss.cloud.nio.multipart.example.config"); context.setServletContext(servletContext); Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(context)); dynamic.setAsyncSupported(true); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1); }
Example 12
Source File: MCRUploadServletDeployer.java From mycore with GNU General Public License v3.0 | 5 votes |
@Override public void startUp(ServletContext servletContext) { if (servletContext != null) { String servletName = "MCRUploadViaFormServlet"; MultipartConfigElement multipartConfig = getMultipartConfig(); try { checkTempStoragePath(multipartConfig.getLocation()); } catch (IOException e) { throw new MCRConfigurationException("Could not setup " + servletName + "!", e); } Dynamic uploadServlet = servletContext.addServlet(servletName, MCRUploadViaFormServlet.class); uploadServlet.addMapping("/servlets/MCRUploadViaFormServlet"); uploadServlet.setMultipartConfig(multipartConfig); } }
Example 13
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 14
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 15
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 16
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 17
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); servlet.setAsyncSupported(true);//① }
Example 18
Source File: WebInitializer.java From springMvc4.x-project with Apache License 2.0 | 5 votes |
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(MyMvcConfig.class); ctx.setServletContext(servletContext); // ② Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3 servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
Example 19
Source File: MojarraInitializer.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Initialize Mojarra. * * @param classes the classes. * @param servletContext the Servlet context. * @throws ServletException when a Servlet error occurs. */ @Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { Dynamic dynamic = servletContext.addServlet("Faces Servlet", "javax.faces.webapp.FacesServlet"); dynamic.addMapping("/faces/*", "*.html", "*.xhtml", "*.jsf"); servletContext.setAttribute("com.sun.faces.facesInitializerMappingsAdded", TRUE); servletContext.addListener("com.sun.faces.config.ConfigureListener"); }
Example 20
Source File: MyFacesInitializer.java From piranha with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Initialize MyFaces. * * @param classes the classes. * @param servletContext the Servlet context. * @throws ServletException when a Servlet error occurs. */ @Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { Dynamic dynamic = servletContext.addServlet("Faces Servlet", "javax.faces.webapp.FacesServlet"); dynamic.addMapping("/faces/*","*.html"); servletContext.addListener("org.apache.myfaces.webapp.StartupServletContextListener"); }