From 583587a3f34a3d2939bcc2b7bcab51b871f2b0c7 Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 20 Mar 2005 21:42:57 +0000 Subject: [PATCH] removed jetty from this repo darcs-hash:20050320214257-5007d-ddbdfcecc11e762bccff1d087a9357d9e85fd961.gz --- src/org/ibex/jetty/Jetty.java | 130 ----------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 src/org/ibex/jetty/Jetty.java diff --git a/src/org/ibex/jetty/Jetty.java b/src/org/ibex/jetty/Jetty.java deleted file mode 100644 index b5fa5fe..0000000 --- a/src/org/ibex/jetty/Jetty.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2000-2005 the Contributors, as shown in the revision logs. -// Licensed under the Apache Public Source License 2.0 ("the License"). -// You may not use this file except in compliance with the License. - -package org.ibex.jetty; -import org.mortbay.jetty.servlet.*; -import org.mortbay.jetty.*; -import org.mortbay.http.handler.*; -import org.mortbay.http.*; -import org.ibex.util.*; -import org.ibex.jinetd.*; -import org.ibex.io.*; -import java.io.*; -import java.net.*; -import java.util.*; - -public class Jetty { - - private static Jetty instance = null; - private static Server hs = null; - private static SocketListener sl = null; - - public static synchronized Jetty instance() { - if (instance != null) return instance; - hs = new Server(); - sl = new SocketListener(); - hs.addListener(sl); - instance = new Jetty(); - try { - ClassLoader cc = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(Jetty.class.getClassLoader()); - sl.setHttpServer(hs); - addContexts(Root.root + "/host", null); - hs.start(); - Thread.currentThread().setContextClassLoader(cc); - } catch (Exception e) { Log.error(Main.class, e); } - return instance; - } - - private static void addContexts(String path, String host) { - try { - File webinf = new File(path + "/WEB-INF"); - if (webinf.exists()) { - String pad = ""; - while(pad.length() + host.length() < 30) pad += " "; - try { - InetAddress.getByName(host); - Log.info(Main.class, pad + host + " => " + path); - WebApplicationContext context = hs.addWebApplication(host, "", path); - context.getServletHandler().getHttpContext().setParentClassLoader(Jetty.class.getClassLoader()); - context.setClassLoaderJava2Compliant(true); - context.setClassLoader(new TreeClassLoader(webinf, Jetty.class.getClassLoader())); - context.setParentClassLoader(Jetty.class.getClassLoader()); - context.setResourceBase(path+"/"); - - ServletHolder sh = context.addServlet("jsp", "*.jsp", "org.apache.jasper.servlet.JspServlet"); - sh.setInitParameter("fork", "false"); - sh.setInitParameter("mappedfile", "true"); - sh.setInitParameter("keepgenerated", "false"); - sh.setInitOrder(0); - - context.setWelcomeFiles(new String[] { "index.jsp", "index.html", "index.xt", "index.txt" }); - ServletHolder def = context.addServlet("default", "/", "org.mortbay.jetty.servlet.Default"); - def.setInitParameter("acceptRanges", "true"); - def.setInitParameter("dirAllowed", "true"); - def.setInitParameter("putAllowed", "false"); - def.setInitParameter("delAllowed", "false"); - def.setInitParameter("redirectWelcome", "false"); - def.setInitParameter("minGzipLength", "8192"); - def.setInitOrder(0); - - context.setDefaultsDescriptor(null); - context.addHandler(new ResourceHandler()); - context.addHandler(new NotFoundHandler()); - context.setWelcomeFiles(new String[] { "index.jsp", "index.html", "index.xt", "index.txt" }); - - } catch (UnknownHostException e) { - Log.warn(Main.class, pad + host + " => " + e.getClass().getName()); - } - //return; - } - File f = new File(path); - if (!f.isDirectory()) return; - String[] list = f.list(); - for(int i=0; i