better defaults
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1167 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
988ff44fc9
commit
88e2b54764
|
@ -10,6 +10,7 @@ file:plugins/jetty-continuation-7.0.2-SNAPSHOT.jar, \
|
|||
file:plugins/jetty-xml-7.0.2-SNAPSHOT.jar, \
|
||||
file:plugins/jetty-io-7.0.2-SNAPSHOT.jar, \
|
||||
file:plugins/jetty-util-7.0.2-SNAPSHOT.jar, \
|
||||
file:plugins/services-3.1.200-v20070605.jar, \
|
||||
file:plugins/jetty-osgi-boot-7.0.2-SNAPSHOT.jar@1:start, \
|
||||
file:plugins/jetty-osgi-boot-warurl-7.0.2-SNAPSHOT.jar@2:start
|
||||
|
||||
|
|
|
@ -102,29 +102,27 @@ public class LibExtClassLoaderHelper {
|
|||
if (f.getName().toLowerCase().startsWith("readme")) {
|
||||
continue;
|
||||
} else {
|
||||
if (urls.isEmpty())
|
||||
{
|
||||
if (urls.isEmpty()) {
|
||||
urls.add(jettyResources.toURI().toURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
processFilesInResourcesFolder(jettyHome, jettyResFiles);
|
||||
}
|
||||
File libEtc = new File(jettyHome, "lib/ext");
|
||||
for (File f : libEtc.listFiles()) {
|
||||
if (f.getName().endsWith(".jar")) {
|
||||
//cheap to tolerate folders so let's do it.
|
||||
URL url = f.toURI().toURL();
|
||||
if (f.isFile()) {//is this necessary anyways?
|
||||
url = new URL("jar:" + url.toString() + "!/");
|
||||
}
|
||||
urls.add(url);
|
||||
}
|
||||
File libExt = new File(jettyHome, "lib/ext");
|
||||
if (libExt.exists()) {
|
||||
for (File f : libExt.listFiles()) {
|
||||
if (f.getName().endsWith(".jar")) {
|
||||
//cheap to tolerate folders so let's do it.
|
||||
URL url = f.toURI().toURL();
|
||||
if (f.isFile()) {//is this necessary anyways?
|
||||
url = new URL("jar:" + url.toString() + "!/");
|
||||
}
|
||||
urls.add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (urls.isEmpty()) {
|
||||
// return parentClassLoader;
|
||||
// }
|
||||
return new URLClassLoader(urls.toArray(new URL[urls.size()]), parentClassLoader);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,15 @@ import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper;
|
|||
import org.eclipse.jetty.osgi.boot.utils.WebappRegistrationCustomizer;
|
||||
import org.eclipse.jetty.osgi.boot.utils.internal.DefaultBundleClassLoaderHelper;
|
||||
import org.eclipse.jetty.osgi.boot.utils.internal.DefaultFileLocatorHelper;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.util.AttributesMap;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -273,22 +279,40 @@ class WebappRegistrationHelper
|
|||
if (!conffile.exists())
|
||||
{
|
||||
__logger.warn("Unable to resolve the jetty/etc file " + etcFile);
|
||||
|
||||
if ("etc/jetty.xml".equals(etcFile))
|
||||
{
|
||||
__logger.info("Configuring default server on 8080");
|
||||
SelectChannelConnector connector = new SelectChannelConnector();
|
||||
connector.setPort(8080);
|
||||
_server.addConnector(connector);
|
||||
|
||||
HandlerCollection handlers = new HandlerCollection();
|
||||
ContextHandlerCollection contexts = new ContextHandlerCollection();
|
||||
RequestLogHandler requestLogHandler = new RequestLogHandler();
|
||||
handlers.setHandlers(new Handler[]
|
||||
{ contexts, new DefaultHandler(), requestLogHandler });
|
||||
_server.setHandler(handlers);
|
||||
}
|
||||
}
|
||||
try
|
||||
else
|
||||
{
|
||||
XmlConfiguration config = new XmlConfiguration(
|
||||
new FileInputStream(conffile));
|
||||
config.getProperties().put("jetty.home", jettyHome);
|
||||
config.getProperties().put("jetty.host", System.getProperty("jetty.host", ""));
|
||||
config.getProperties().put("jetty.port", System.getProperty("jetty.port", "8080"));
|
||||
config.getProperties().put("jetty.port.ssl", System.getProperty("jetty.port.ssl", "8443"));
|
||||
config.configure(_server);
|
||||
}
|
||||
catch (SAXParseException saxparse)
|
||||
{
|
||||
Log.getLogger(WebappRegistrationHelper.class.getName())
|
||||
.warn("Unable to configure the jetty/etc file " + etcFile, saxparse);
|
||||
throw saxparse;
|
||||
try
|
||||
{
|
||||
XmlConfiguration config = new XmlConfiguration(
|
||||
new FileInputStream(conffile));
|
||||
config.getIdMap().put("server","_server");
|
||||
config.getProperties().put("jetty.home", jettyHome);
|
||||
config.getProperties().put("jetty.host", System.getProperty("jetty.host", ""));
|
||||
config.getProperties().put("jetty.port", System.getProperty("jetty.port", "8080"));
|
||||
config.getProperties().put("jetty.port.ssl", System.getProperty("jetty.port.ssl", "8443"));
|
||||
}
|
||||
catch (SAXParseException saxparse)
|
||||
{
|
||||
Log.getLogger(WebappRegistrationHelper.class.getName())
|
||||
.warn("Unable to configure the jetty/etc file " + etcFile, saxparse);
|
||||
throw saxparse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue