@Test public void testHandleResourcePath() { ServletContextBeanArchiveHandler handler = new ServletContextBeanArchiveHandler(new ServletContextMock()); BeanArchiveBuilder builder = handler.handle(WebAppBeanArchiveScanner.WEB_INF_CLASSES); Collection<String> classes = builder.getClasses(); assertEquals(4, classes.size()); assertTrue(classes.contains("org.Alpha")); assertTrue(classes.contains("org.foo.Bravo")); assertTrue(classes.contains("org.foo.Charlie")); assertTrue(classes.contains("org.bar.Delta")); }
private void handleResourcePath(String rootPath, String resourcePath, BeanArchiveBuilder builder) { WeldServletLogger.LOG.debugv("Handle resource path: {0}", resourcePath); Set<String> subpaths = servletContext.getResourcePaths(resourcePath); if (subpaths != null && !subpaths.isEmpty()) { for (String subpath : subpaths) { if (subpath.endsWith(SLASH)) { handleResourcePath(rootPath, subpath, builder); } else if (subpath.endsWith(Files.CLASS_FILE_EXTENSION)) { add(rootPath, subpath, builder); } } } }
ServletContextBeanArchiveHandler implements BeanArchiveHandler { private void handleResourcePath(String rootPath, String resourcePath, BeanArchiveBuilder builder) { WeldServletLogger.LOG.debugv("Handle resource path: {0}", resourcePath); Set<String> subpaths = servletContext.getResourcePaths(resourcePath); if (subpaths != null && !subpaths.isEmpty()) { for (String subpath : subpaths) { if (subpath.endsWith(SLASH)) { handleResourcePath(rootPath, subpath, builder); } else if (subpath.endsWith(Files.CLASS_FILE_EXTENSION)) { add(rootPath, subpath, builder); } } } } }
ServletContextBeanArchiveHandler implements BeanArchiveHandler { private void handleResourcePath(String rootPath, String resourcePath, BeanArchiveBuilder builder) { WeldServletLogger.LOG.debugv("Handle resource path: {0}", resourcePath); Set<String> subpaths = servletContext.getResourcePaths(resourcePath); if (subpaths != null && !subpaths.isEmpty()) { for (String subpath : subpaths) { if (subpath.endsWith(SLASH)) { handleResourcePath(rootPath, subpath, builder); } else if (subpath.endsWith(Files.CLASS_FILE_EXTENSION)) { add(rootPath, subpath, builder); } } } } ServletContextBeanArchiveHandler(ServletContext servletContext); }
ServletContextBeanArchiveHandler implements BeanArchiveHandler { private void handleResourcePath(String rootPath, String resourcePath, BeanArchiveBuilder builder) { WeldServletLogger.LOG.debugv("Handle resource path: {0}", resourcePath); Set<String> subpaths = servletContext.getResourcePaths(resourcePath); if (subpaths != null && !subpaths.isEmpty()) { for (String subpath : subpaths) { if (subpath.endsWith(SLASH)) { handleResourcePath(rootPath, subpath, builder); } else if (subpath.endsWith(Files.CLASS_FILE_EXTENSION)) { add(rootPath, subpath, builder); } } } } ServletContextBeanArchiveHandler(ServletContext servletContext); @Override BeanArchiveBuilder handle(String path); }
ServletContextBeanArchiveHandler implements BeanArchiveHandler { private void handleResourcePath(String rootPath, String resourcePath, BeanArchiveBuilder builder) { WeldServletLogger.LOG.debugv("Handle resource path: {0}", resourcePath); Set<String> subpaths = servletContext.getResourcePaths(resourcePath); if (subpaths != null && !subpaths.isEmpty()) { for (String subpath : subpaths) { if (subpath.endsWith(SLASH)) { handleResourcePath(rootPath, subpath, builder); } else if (subpath.endsWith(Files.CLASS_FILE_EXTENSION)) { add(rootPath, subpath, builder); } } } } ServletContextBeanArchiveHandler(ServletContext servletContext); @Override BeanArchiveBuilder handle(String path);  }