Commit 24212c49 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Checking in for RC2 - ability to retrieve context

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6906 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1e9fd90d
...@@ -13,6 +13,9 @@ package org.jivesoftware.wildfire.http; ...@@ -13,6 +13,9 @@ package org.jivesoftware.wildfire.http;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
import org.mortbay.jetty.Connector; import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.webapp.WebAppContext; import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.jetty.security.SslSocketConnector; import org.mortbay.jetty.security.SslSocketConnector;
import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.jetty.nio.SelectChannelConnector;
...@@ -56,18 +59,21 @@ public final class HttpBindManager { ...@@ -56,18 +59,21 @@ public final class HttpBindManager {
private HttpSessionManager httpSessionManager; private HttpSessionManager httpSessionManager;
private ContextHandlerCollection contexts;
public static HttpBindManager getInstance() { public static HttpBindManager getInstance() {
return instance; return instance;
} }
private HttpBindManager() { private HttpBindManager() {
// Configure Jetty logging to a more reasonable default. // Configure Jetty logging to a more reasonable default.
System.setProperty("org.mortbay.log.class", "org.jivesoftware.util.log.util.JettyLog"); // System.setProperty("org.mortbay.log.class", "org.jivesoftware.util.log.util.JettyLog");
// JSP 2.0 uses commons-logging, so also override that implementation. // // JSP 2.0 uses commons-logging, so also override that implementation.
System.setProperty("org.apache.commons.logging.LogFactory", "org.jivesoftware.util.log.util.CommonsLogFactory"); // System.setProperty("org.apache.commons.logging.LogFactory", "org.jivesoftware.util.log.util.CommonsLogFactory");
PropertyEventDispatcher.addListener(new HttpServerPropertyListener()); PropertyEventDispatcher.addListener(new HttpServerPropertyListener());
this.httpSessionManager = new HttpSessionManager(); this.httpSessionManager = new HttpSessionManager();
contexts = new ContextHandlerCollection();
} }
public void start() { public void start() {
...@@ -254,17 +260,21 @@ public final class HttpBindManager { ...@@ -254,17 +260,21 @@ public final class HttpBindManager {
if (httpsConnector != null) { if (httpsConnector != null) {
httpBindServer.addConnector(httpsConnector); httpBindServer.addConnector(httpsConnector);
} }
createWebAppContext();
httpBindServer.addHandler(createWebAppContext()); httpBindServer.setHandlers(new Handler[] { contexts, new DefaultHandler() });
} }
private WebAppContext createWebAppContext() { private WebAppContext createWebAppContext() {
WebAppContext context = new WebAppContext(JiveGlobals.getHomeDirectory() + File.separator + WebAppContext context = new WebAppContext(contexts, JiveGlobals.getHomeDirectory() +
"resources" + File.separator + "spank", "/"); File.separator + "resources" + File.separator + "spank", "/");
context.setWelcomeFiles(new String[]{"index.html"}); context.setWelcomeFiles(new String[]{"index.html"});
return context; return context;
} }
public ContextHandlerCollection getContexts() {
return contexts;
}
private void doEnableHttpBind(boolean shouldEnable) { private void doEnableHttpBind(boolean shouldEnable) {
if (shouldEnable && httpBindServer == null) { if (shouldEnable && httpBindServer == null) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment