public String name(String file) throws IOException { return assertMatch(file).group(1); }
public void testMatch() throws Exception { assertMatch("/", null, "/"); assertMatch("/a", "a", ""); assertMatch("/a/", "a", "/"); assertMatch("/a/b", "b", ""); assertMatch("/a/b/", "b", "/"); }
public void testNotMatch() throws Exception { assertNotMatch("a"); assertNotMatch("a/"); assertNotMatch("a/a"); } }
@Override public Mount<String> create(Path path) throws IOException { return new Mount<String>(new ServletContextDriver(context, path.absolute().getValue()), "war:" + path.absolute().getValue()); } }
@Override public void afterPropertiesSet() throws Exception { // Configure the war driver drivers.put("war", new WarMountFactory(servletContext)); // super.afterPropertiesSet(); }
private void assertMatch(String s, String name, String trail) { Matcher m = ServletContextDriver.pathPattern.matcher(s); assertTrue(m.matches()); assertEquals(name, m.group(1)); assertEquals(trail, m.group(2)); }
private void assertNotMatch(String s) { Matcher m = ServletContextDriver.pathPattern.matcher(s); assertFalse(m.matches()); }
public ServletContextDriver(ServletContext ctx, String root) { if (ctx == null) { throw new NullPointerException(); } if (root == null) { throw new NullPointerException(); } assertMatch(root); // this.ctx = ctx; this.root = root; }
/** * Create the command file system, this method binds the <code>/WEB-INF/crash/commands/</code> path of the * servlet context. * * @param context the servlet context * @return the command file system */ protected FS createCommandFS(ServletContext context) { return new FS().mount(new ServletContextDriver(context, "/WEB-INF/crash/commands/")); }
public void contextInitialized(ServletContextEvent sce) { context = sce.getServletContext(); // Use JVM properties as external config setConfig(System.getProperties()); // Initialise the registerable drivers try { mountContexts.put("classpath", new ClassPathMountFactory(context.getClassLoader())); mountContexts.put("file", new FileMountFactory(Utils.getCurrentDirectory())); mountContexts.put("war", new WarMountFactory(context)); } catch (Exception e) { log.log(Level.SEVERE, "Coult not initialize classpath driver", e); return; } // String contextPath = context.getContextPath(); synchronized (lock) { if (!contextMap.containsKey(contextPath)) { ClassLoader webAppLoader = Thread.currentThread().getContextClassLoader(); PluginDiscovery discovery = createDiscovery(context, webAppLoader); PluginContext pluginContext = start(new ServletContextMap(context), discovery, context.getClassLoader()); contextMap.put(contextPath, pluginContext); registered = true; } } }
public boolean isDir(String file) throws IOException { Matcher matcher = assertMatch(file); String slash = matcher.group(2); return "/".equals(slash); }
/** * Create the conf file system, this method binds the <code>/WEB-INF/crash/</code> path of the * servlet context. * * @param context the servlet context * @return the conf file system */ protected FS createConfFS(ServletContext context) { return new FS().mount(new ServletContextDriver(context, "/WEB-INF/crash/")); }
public ServletContextDriver(ServletContext ctx, String root) { if (ctx == null) { throw new NullPointerException(); } if (root == null) { throw new NullPointerException(); } assertMatch(root); // this.ctx = ctx; this.root = root; }
public String name(String file) throws IOException { return assertMatch(file).group(1); }
public String name(String file) throws IOException { return assertMatch(file).group(1); }
public String name(String file) throws IOException { return assertMatch(file).group(1); }
public ServletContextDriver(ServletContext ctx, String root) { if (ctx == null) { throw new NullPointerException(); } if (root == null) { throw new NullPointerException(); } assertMatch(root); // this.ctx = ctx; this.root = root; }
public ServletContextDriver(ServletContext ctx, String root) { if (ctx == null) { throw new NullPointerException(); } if (root == null) { throw new NullPointerException(); } assertMatch(root); // this.ctx = ctx; this.root = root; }
public boolean isDir(String file) throws IOException { Matcher matcher = assertMatch(file); String slash = matcher.group(2); return "/".equals(slash); }
public boolean isDir(String file) throws IOException { Matcher matcher = assertMatch(file); String slash = matcher.group(2); return "/".equals(slash); }