diff --git a/build.properties b/build.properties index 4a84d219c..2b571ac16 100644 --- a/build.properties +++ b/build.properties @@ -11,10 +11,7 @@ # Note: Include the trailing slash! Don't surround the URL in quotes! javasedocs.url=https://docs.oracle.com/javase/8/docs/api/ javaeedocs.url=https://docs.oracle.com/javaee/7/api/ -# The following link is for 9.4.x -#jettydocs.url=http://download.eclipse.org/jetty/stable-9/apidocs/ -# last one available on archive.eclipse.org -jettydocs.url=https://archive.eclipse.org/jetty/9.3.9.v20160517/apidocs/ +jettydocs.url=https://javadoc.jetty.org/jetty-12/index.html wrapperdocs.url=https://wrapper.tanukisoftware.com/jdoc/ # these are only for unit test javadocs i2pdocs.url=http://docs.i2p-projekt.de/javadoc/ diff --git a/router/java/src/net/i2p/router/startup/MigrateJetty.java b/router/java/src/net/i2p/router/startup/MigrateJetty.java index ce5a1b2c1..3ea1033e7 100644 --- a/router/java/src/net/i2p/router/startup/MigrateJetty.java +++ b/router/java/src/net/i2p/router/startup/MigrateJetty.java @@ -163,6 +163,7 @@ abstract class MigrateJetty { } catch (IOException ioe) { System.err.println("WARNING: Failed to migrate XML file " + xmlFile + ", cannot migrate " + client); + ioe.printStackTrace(); continue; } migration2success = true; @@ -207,6 +208,7 @@ abstract class MigrateJetty { } catch (IOException ioe) { System.err.println("WARNING: Failed to migrate XML file " + xmlFile + ", cannot migrate " + client); + ioe.printStackTrace(); continue; } migration3success = true; @@ -215,7 +217,8 @@ abstract class MigrateJetty { File xmlFile = new File(args[0]); if (!xmlFile.isAbsolute()) xmlFile = new File(ctx.getAppDir(), args[0]); - xmlFile = new File(xmlFile.getParentFile(), "jetty-gzip.xml"); + File base = xmlFile.getParentFile(); + xmlFile = new File(base, "jetty-gzip.xml"); if (xmlFile.exists()) { boolean ok = backupFile(xmlFile, backupSuffix); if (ok) @@ -226,6 +229,34 @@ abstract class MigrateJetty { System.err.println("WARNING: Failed to backup up XML file " + xmlFile + ", cannot migrate " + client); } + // contexts/base-context.xml + xmlFile = new File(base, "contexts/base-context.xml"); + if (xmlFile.exists()) { + try { + boolean ok = backupFile(xmlFile, backupSuffix); + if (ok) { + File tmpFile = new File(xmlFile + ".tmp"); + migrateBaseContextXML(xmlFile, tmpFile); + ok = FileUtil.rename(tmpFile, xmlFile); + if (!ok) + throw new IOException(); + System.err.println("Modified " + xmlFile); + } + } catch (IOException ioe) { + System.err.println("WARNING: Failed to migrate XML file " + xmlFile + + ", cannot migrate " + client); + ioe.printStackTrace(); + } + } + // contexts/cgi-context.xml + xmlFile = new File(base, "contexts/cgi-context.xml"); + if (xmlFile.exists()) { + File save = new File(xmlFile + BACKUP_SUFFIX_9_2); + FileUtil.rename(xmlFile, save); + System.err.println("WARNING: CGI not supported on Jetty 12 and has been disabled."); + System.err.println(xmlFile + " moved to " + save); + System.err.println("See http://zzz.i2p/topics/3701 for help on migrating to FCGI if required"); + } } System.err.println("Migrated " + client); @@ -398,4 +429,79 @@ abstract class MigrateJetty { if (out != null) out.close(); } } + + private static final String M10 = "jetty/configure.dtd"; + private static final String R10 = ""; + + private static final String M11 = "org.eclipse.jetty.servlet.ServletContextHandler"; + private static final String R11 = ""; + + private static final String M12 = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " "; + + private static final String M13 = "'); + int lt = s.lastIndexOf('<'); + if (gt >= 0 && lt >= 0 && lt > gt) { + String rb = s.substring(gt + 1, lt).trim(); + out.println(" "); + out.println(" " + rb + ""); + out.println(" "); + out.println(R12); + } + } else if (s.contains(M13)) { + // strip to matching + int i = 1; + String t; + while ((t = DataHelper.readLine(in)) != null) { + if (t.contains(""); + System.err.println("Copied " + oldFile + " with modifications"); + } finally { + if (in != null) try { in.close(); } catch (IOException ioe) {} + if (out != null) out.close(); + } + } } diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java index a6e2537ba..ded98de58 100644 --- a/router/java/src/net/i2p/router/startup/WorkingDir.java +++ b/router/java/src/net/i2p/router/startup/WorkingDir.java @@ -246,7 +246,8 @@ public class WorkingDir { success &= migrateJettyXml(oldEep, newEep, "jetty.xml", "./eepsite/", newPath); success &= migrateJettyXml(oldEep, newEep, "jetty-ssl.xml", "./eepsite/", newPath); success &= migrateJettyXml(oldEep, newEep, "contexts/base-context.xml", "./eepsite/", newPath); - success &= migrateJettyXml(oldEep, newEep, "contexts/cgi-context.xml", "./eepsite/", newPath); + // FCGI requires additional libs + //success &= migrateJettyXml(oldEep, newEep, "contexts/cgi-context.xml", "./eepsite/", newPath); success &= migrateClientsConfig(oldDirf, dirf); // for later news.xml updates (we don't copy initialNews.xml over anymore) success &= (new SecureDirectory(dirf, "docs")).mkdir();