- private static void createContext(Host host) throws Exception {
- WebApplicationContext context = new WebApplicationContext(host.path);
- context.setContextPath("");
+ private static void createContext(Host host, String path, int depth) throws Exception {
+ Log.warn(host, "scanning " + path);
+ if (!new File(path+"/WEB-INF/web.xml").exists()) {
+ if (depth >= 4) return;
+ for(String s : new File(path).list()) {
+ if (new File(path+"/"+s).isDirectory()) {
+ try {
+ createContext(host, path+"/"+s, depth+1);
+ } catch (Exception ex) {
+ Log.warn(Jetty.class, ex);
+ }
+ }
+ }
+ return;
+ }
+ WebApplicationContext context = new WebApplicationContext(path);
+ String webPath = path.substring(host.path.length());
+ if (webPath.endsWith("/_")) webPath = webPath.substring(0, webPath.length()-1);
+ if (webPath.endsWith("/_/")) webPath = webPath.substring(0, webPath.length()-2);
+ System.out.println("mapping " + webPath + " as " + path);
+ context.setContextPath(webPath);