Skip to content

Commit

Permalink
Port o.e.equinox.http.jetty to Jetty 12
Browse files Browse the repository at this point in the history
Port is straightforward except for logging as EquinoxStdErrLog had to be
removed as this org.eclipse.jetty.util.log api is totally gone and has
been deprecated since Jetty 10.x.
According to
https://eclipse.dev/jetty/documentation/jetty-12/operations-guide/index.html#og-server-logging
there is no longer programatic way to configure logging.
  • Loading branch information
akurtakov committed Oct 3, 2023
1 parent 0bd1dd7 commit 3f80840
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 222 deletions.
20 changes: 10 additions & 10 deletions bundles/org.eclipse.equinox.http.jetty/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ Bundle-Activator: org.eclipse.equinox.http.jetty.internal.Activator
Import-Package: javax.servlet;version="[3.1.0,5.0.0)",
javax.servlet.http;version="[3.1.0,5.0.0)",
org.eclipse.equinox.http.servlet;version="[1.2.0,2.0.0)",
org.eclipse.jetty.http;version="[10.0.2,11.0.0)",
org.eclipse.jetty.server;version="[10.0.2,11.0.0)",
org.eclipse.jetty.server.handler;version="[10.0.2,11.0.0)",
org.eclipse.jetty.server.session;version="[10.0.2,11.0.0)",
org.eclipse.jetty.servlet;version="[10.0.2,11.0.0)",
org.eclipse.jetty.util;version="[10.0.2,11.0.0)",
org.eclipse.jetty.util.component;version="[10.0.2,11.0.0)",
org.eclipse.jetty.util.log;version="[10.0.2,11.0.0)",
org.eclipse.jetty.util.ssl;version="[10.0.2,11.0.0)",
org.eclipse.jetty.util.thread;version="[10.0.2,11.0.0)",
org.eclipse.jetty.http;version="[12.0.1,13.0.0)",
org.eclipse.jetty.server;version="[12.0.1,13.0.0)",
org.eclipse.jetty.server.handler;version="[12.0.1,13.0.0)",
org.eclipse.jetty.session;version="[12.0.1,13.0.0)",
org.eclipse.jetty.ee8.servlet;version="[12.0.1,13.0.0)",
org.eclipse.jetty.ee8.nested;version="[12.0.1,13.0.0)",
org.eclipse.jetty.util;version="[12.0.1,13.0.0)",
org.eclipse.jetty.util.component;version="[12.0.1,13.0.0)",
org.eclipse.jetty.util.ssl;version="[12.0.1,13.0.0)",
org.eclipse.jetty.util.thread;version="[12.0.1,13.0.0)",
org.osgi.framework;version="1.3.0",
org.osgi.framework.startlevel;version="1.0.0",
org.osgi.framework.wiring;version="1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
package org.eclipse.equinox.http.jetty.internal;

import java.io.File;
import java.util.*;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;

import org.eclipse.equinox.http.jetty.JettyConstants;
import org.osgi.framework.*;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.startlevel.BundleStartLevel;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
Expand Down Expand Up @@ -48,7 +54,6 @@ public class Activator implements BundleActivator {
// Valid values are in increasing threshold: "debug", "info", "warn", "error",
// and "off"
// (default threshold is "warn")
private static final String LOG_STDERR_THRESHOLD = "org.eclipse.equinox.http.jetty.log.stderr.threshold"; //$NON-NLS-1$

// The staticServerManager is use by the start and stopServer methods and must
// be accessed in a static synchronized block
Expand All @@ -62,7 +67,6 @@ public class Activator implements BundleActivator {
public void start(BundleContext context) throws Exception {
File jettyWorkDir = new File(context.getDataFile(""), JETTY_WORK_DIR); //$NON-NLS-1$
jettyWorkDir.mkdir();
EquinoxStdErrLog.setThresholdLogger(context.getProperty(LOG_STDERR_THRESHOLD));
httpServerManager = new HttpServerManager(jettyWorkDir);

boolean autostart = Details.getBoolean(context, AUTOSTART, false);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@
import org.eclipse.equinox.http.jetty.JettyConstants;
import org.eclipse.equinox.http.jetty.JettyCustomizer;
import org.eclipse.equinox.http.servlet.HttpServiceServlet;
import org.eclipse.jetty.ee8.nested.SessionHandler;
import org.eclipse.jetty.ee8.servlet.ServletContextHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.eclipse.jetty.http.UriCompliance;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.session.HouseKeeper;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.session.DefaultSessionIdManager;
import org.eclipse.jetty.session.HouseKeeper;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.osgi.framework.Constants;
Expand Down Expand Up @@ -169,12 +170,19 @@ public synchronized void updated(String pid, Dictionary<String, ?> dictionary) t
httpContext = (ServletContextHandler) customizer.customizeContext(httpContext, dictionary);

try {
DefaultSessionIdManager idMgr = new DefaultSessionIdManager(server);
server.addBean(idMgr, true);

HouseKeeper houseKeeper = new HouseKeeper();
houseKeeper.setSessionIdManager(idMgr);
// set the frequency of scavenge cycles
houseKeeper.setIntervalSec(
Details.getLong(dictionary, JettyConstants.HOUSEKEEPER_INTERVAL, houseKeeper.getIntervalSec()));
idMgr.setSessionHouseKeeper(houseKeeper);
server.start();
SessionHandler sessionManager = httpContext.getSessionHandler();
sessionManager.addEventListener((HttpSessionIdListener) holder.getServlet());
HouseKeeper houseKeeper = server.getSessionIdManager().getSessionHouseKeeper();
houseKeeper.setIntervalSec(
Details.getLong(dictionary, JettyConstants.HOUSEKEEPER_INTERVAL, houseKeeper.getIntervalSec()));

} catch (Exception e) {
throw new ConfigurationException(pid, e.getMessage(), e);
}
Expand Down

0 comments on commit 3f80840

Please sign in to comment.