Add more markers and protection for xml file migration

Add error message for jetty-jmx.xml migration, don't migrate
Update non-default files jetty-rewrite.xml and jetty-jmx.xml
This commit is contained in:
zzz
2017-03-10 18:48:48 +00:00
parent 4e236fc5ab
commit 6b4f665f34
6 changed files with 38 additions and 85 deletions

View File

@ -262,9 +262,6 @@
<zipfileset src="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar"/>
</jar>
<!-- Ant bug, don't set update and filesetmanifest or the update doesn't happen,
Their bug tracker claims fixed in 1.8.0 but broken for me in 1.8.1
-->
<jar destfile="jettylib/commons-logging.jar" update="true" >
<manifest>
<attribute name="Note" value="Intentionally empty" />

View File

@ -1,12 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================================ -->
<!-- To correctly start Jetty with JMX module enabled, this configuration -->
<!-- file must appear first in the list of the configuration files. -->
<!-- The simplest way to achieve this is to add etc/jetty-jmx.xml as the -->
<!-- first file in configuration file list at the end of start.ini file. -->
<!-- ============================================================================ -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
@ -21,83 +15,29 @@
-->
<!-- =========================================================== -->
<!-- Initialize an mbean server -->
<!-- Get the platform mbean server -->
<!-- =========================================================== -->
<Call id="MBeanServer" class="java.lang.management.ManagementFactory"
name="getPlatformMBeanServer" />
<!-- =========================================================== -->
<!-- Initialize the Jetty MBean container -->
<!-- Initialize the Jetty MBean container -->
<!-- =========================================================== -->
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg><Ref id="MBeanServer" /></Arg>
<Call name="start"/>
</New>
<!-- Add to the Server to listen for object events -->
<Get id="Container" name="container">
<Call name="addEventListener">
<Arg><Ref id="MBeanContainer" /></Arg>
</Call>
</Get>
<!-- Add to the Server as a managed lifecycle -->
<Call name="addBean">
<Arg><Ref id="MBeanContainer"/></Arg>
<Arg type="boolean">true</Arg>
<Arg>
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg>
<Ref refid="MBeanServer" />
</Arg>
</New>
</Arg>
</Call>
<!-- Add the static log -->
<Ref id="MBeanContainer">
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.log.Log"/>
</Arg>
</Call>
</Ref>
<!-- In order to connect to the JMX server remotely from a different
process, possibly running on a different host, Jetty JMX module
can create a remote JMX connector. It requires RMI registry to
be started prior to creating the connector server because the
JMX specification uses RMI to facilitate connections.
-->
<!-- Optionally start the RMI registry. Normally RMI registry runs on
port 1099. The argument below can be changed in order to comply
with the firewall requirements.
-->
<!--
<Call name="createRegistry" class="java.rmi.registry.LocateRegistry">
<Arg type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport" default="1099"/></Arg>
<Call name="sleep" class="java.lang.Thread">
<Arg type="java.lang.Integer">1000</Arg>
</Call>
</Call>
-->
<!-- Optionally add a remote JMX connector. The parameters of the constructor
below specify the JMX service URL, and the object name string for the
connector server bean. The parameters of the JMXServiceURL constructor
specify the protocol that clients will use to connect to the remote JMX
connector (RMI), the hostname of the server (local hostname), port number
(automatically assigned), and the URL path. Note that URL path contains
the RMI registry hostname and port number, that may need to be modified
in order to comply with the firewall requirements.
-->
<!--
<New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
<Call name="addBean">
<Arg>
<New class="javax.management.remote.JMXServiceURL">
<Arg type="java.lang.String">rmi</Arg>
<Arg type="java.lang.String" />
<Arg type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport" default="1099"/></Arg>
<Arg type="java.lang.String">/jndi/rmi://<SystemProperty name="jetty.jmxrmihost" default="localhost"/>:<SystemProperty name="jetty.jmxrmiport" default="1099"/>/jmxrmi</Arg>
</New>
<New class="org.eclipse.jetty.util.log.Log" />
</Arg>
<Arg>org.eclipse.jetty.jmx:name=rmiconnectorserver</Arg>
<Call name="start" />
</New>
-->
</Call>
</Configure>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Mixin the RewriteHandler -->
@ -15,7 +15,7 @@
<Set name="handler">
<New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Set name="handler"><Ref id="oldhandler"/></Set>
<Set name="handler"><Ref refid="oldhandler"/></Set>
<Set name="rewriteRequestURI">true</Set>
<Set name="rewritePathInfo">false</Set>
<Set name="originalPathAttribute">requestedPath</Set>

View File

@ -1,6 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- This configuration supports Jetty 9. Do not remove this line. -->
<!-- ========================================================================= -->
<!-- If you have a 'split' directory installation, with configuration -->
<!-- files in ~/.i2p (Linux), %APPDATA%\I2P (Windows), -->

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- This configuration supports Jetty 9. Do not remove this line. -->
<!-- ========================================================================= -->
<!-- This file configures the Jetty server. -->
<!-- All changes require a restart of I2P. -->

View File

@ -215,6 +215,12 @@ abstract class MigrateJetty {
* @since Jetty 9
*/
private static boolean migrateToJetty9(File xmlFile) {
if (xmlFile.getName().equals("jetty-jmx.xml")) {
// This is lazy but nobody's using jmx, not worth the trouble
System.err.println("ERROR: Migration of " + xmlFile +
" file is not supported. Copy new file from $I2P/eepsite-jetty9/jetty-jmx.xml");
return false;
}
// we don't re-migrate from the template, we just add the
// necessary args for the QueuedThreadPool constructor in-place
// and fixup the renamed set call
@ -237,7 +243,13 @@ abstract class MigrateJetty {
// readLine() doesn't strip \r
if (s.endsWith("\r"))
s = s.substring(0, s.length() - 1);
if (s.contains("org.eclipse.jetty.util.thread.QueuedThreadPool")) {
if (s.contains("Modified by I2P migration script for Jetty 9.") ||
s.contains("This configuration supports Jetty 9.") ||
s.contains("http://www.eclipse.org/jetty/configure_9_0.dtd")) {
if (!modified)
break;
// else we've modified it twice?
} else if (s.contains("org.eclipse.jetty.util.thread.QueuedThreadPool")) {
foundQTP = true;
} else if (foundQTP) {
if (!(s.contains("Modified by") || s.contains("<Arg type=\"int\">"))) {