Changeset 0703a29 for apps/jetty


Ignore:
Timestamp:
Mar 11, 2017 3:24:23 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
aea20a5
Parents:
072d990 (diff), db0381d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p.zzz.jetty9' (head 80022f6ef552acd1382d45103969aa7c17b1d794)

to branch 'i2p.i2p' (head 3b4b418ae8be95d52228fc7c325fc52e0223e4fe)

Location:
apps/jetty
Files:
19 added
24 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • apps/jetty/build.xml

    r072d990 r0703a29  
    44    <!-- This copies jars, with some modifications and renaming,
    55         from the jetty-distribution directory to the jettylib directory.
    6          This is disabled if the property with-libjetty8-java=true.
     6         This is disabled if the property with-libjetty9-java=true.
    77
    88         This copies jars, with some modifications and renaming,
     
    1515
    1616    <!-- Note: Please change all references in top-level build.xml if you update to a new Jetty! -->
    17     <property name="jetty.ver" value="8.1.21.v20160908" />
     17    <!-- unused until we go to 9.3 -->
     18    <property name="jetty.branch" value="stable-9" />
     19    <property name="jetty.ver" value="9.2.21.v20170120" />
    1820    <property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
    19     <property name="jetty.sha1" value="9780e99e765fd7b9bb1aac8ba2bba374ac039764" />
     21    <property name="jetty.sha1" value="3dcd4f66cc3f72800a2ee53fecf7b3f9d3f23eb2" />
    2022    <property name="jetty.filename" value="${jetty.base}.zip" />
    21     <property name="jetty.url" value="http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" />
     23    <!-- change jetty.ver to jetty.branch for 9.3 -->
     24    <property name="jetty.url" value="http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/${jetty.ver}/${jetty.filename}" />
    2225    <property name="verified.filename" value="verified.txt" />
    2326    <property name="javac.compilerargs" value="" />
    2427    <property name="javac.version" value="1.7" />
    25     <property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
    26     <property name="tomcat.ver" value="6.0.48" />
    27     <property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
    28     <property name="tomcat2.lib.small" value="apache-tomcat/lib" />
    2928
    3029    <target name="all" depends="build" />
     
    4241        <condition property="jetty.zip.extracted" >
    4342            <or>
    44                 <istrue value="${with-libjetty8-java}" />
     43                <istrue value="${with-libjetty9-java}" />
    4544                <available file="${jetty.base}" type="dir" />
    4645            </or>
     
    5453        <condition property="verified.already" >
    5554            <or>
    56                 <istrue value="${with-libjetty8-java}" />
     55                <istrue value="${with-libjetty9-java}" />
    5756                <istrue value="${jetty.zip.extracted}" />
    5857                <and>
     
    121120
    122121    <!-- Jetty and tomcat files -->
    123     <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib" />
     122    <!--
     123         We support the following configurations:
     124           no system jars: Precise, Trusty
     125           with-libtomcat8-java: Jessie (without backports), Wheezy
     126           with-libtomcat8-java AND with-libjetty9-java: Xenial, Jessie (with backports), Stretch
     127           with-libjetty9-java (only): not supported
     128     -->
     129    <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib1, copyJettylib2, copyTomcatLib" />
    124130
    125131    <!-- Jetty files only -->
    126     <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty8-java}" >
     132    <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty9-java}" >
    127133      <!-- We copy everything to names without the version numbers so we
    128134           can update them later. Where there was something similar in Jetty 5/6,
     
    167173            </manifest>
    168174        </jar>
     175    </target>
     176
     177    <!-- If with-libtomcat8-java but not with-libjetty9-java, we don't do this -->
     178    <target name="copyJettylib2" depends="extractJettylib" unless="${with-libtomcat8-java}" >
    169179        <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
    170             <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/servlet-api-3.0.jar" />
    171             <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.2.0.v201112011158.jar" />
     180            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/servlet-api-3.1.jar" />
     181          <!--
     182            Jetty version - see below for why we don't use this one
     183            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/javax.servlet.jsp-api-2.3.1.jar" />
     184           -->
     185            <!-- Apache version -->
     186            <!-- Also includes org.apache.*, this is copied into jasper-runtime.jar below -->
     187            <zipfileset includes="javax/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/>
     188            <!-- In Debian packages they are found in /usr/share/java/tomcat8-servlet-api.jar in the libtomcat8-java package -->
     189            <!-- javax/servlet/jsp/resources are dups of those in apache-jsp jar -->
     190            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties javax/servlet/jsp/resources/*" src="${jetty.base}/lib/jetty-schemas-3.1.jar" />
    172191        </jar>
    173192      <!--
     
    175194        <delete dir="${jetty.base}" />
    176195      -->
    177         <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over,
    178              needed for old plugins and things. We add tomcat-juli below.
    179           -->
    180       <!--
    181         * Removed in 0.9.24, see ticket #1679
    182         * Jetty now uses tomcat-juli (added below to commons-logging.jar), not commons-logging proper,
    183         * and no known plugins use it either.
    184         <jar destfile="jettylib/commons-logging.jar" filesetmanifest="mergewithoutmain" >
    185             <zipfileset excludes="META-INF/LICENSE.txt META-INF/NOTICE.txt" src="../../installer/lib/launch4j/lib/commons-logging.jar" />
    186         </jar>
    187       -->
    188     </target>
    189 
    190     <!-- Tomcat util jar.
    191          As of Tomcat 6.0.39, the deployer does not contain some classes that are required
    192          to precompile jsps with tags (SusiDNS and i2p-bote).
    193          These classes are in the main Tomcat package, in lib/tomcat-coyote.jar.
    194          As the jar is 800 KB and we only need 12 KB of that, we extract the required classes
    195          to a new jar, created and checked in using this target.
    196          Apparently this is only required for precompilation of jsps, so this is put in
    197          with the JspC compiler jasper-runtime.jar below.
    198      -->
    199     <target name="buildTomcatUtilJar" unless="${with-libservlet2.5-java}" >
    200         <!-- take only what we need from the tomcat-coyote jar -->
    201         <jar destfile="${tomcat2.lib.small}/tomcat-coyote-util.jar" >
    202             <zipfileset src="${tomcat2.lib}/tomcat-coyote.jar"
    203              includes="org/apache/tomcat/util/descriptor/* org/apache/tomcat/util/res/*" />
    204         </jar>
    205     </target>
     196    </target>
     197
    206198
    207199    <!-- Tomcat.
     
    222214    <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" />
    223215
    224     <target name="copyTomcatLib1" unless="${with-libservlet2.5-java}" >
     216    <target name="copyTomcatLib1" >
    225217        <condition property="with-libtomcat-java" >
    226218            <or>
     
    234226
    235227    <target name="copyTomcatLib2" unless="${with-libtomcat-java}" >
    236         <!-- EL libs.
     228        <!-- EL API and compiler libs.
    237229             Tomcat 6 has EL 2.1.
    238230             Tomcat 7 / libservlet3.0 has EL 2.2.
     231             Jetty 9 / Tomcat 8 / libservlet3.1 has EL 3.0.
    239232             According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2
    240233             2.2 is backwards-compatible with 2.1.
    241234         -->
    242         <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
    243             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
    244             <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
    245         </jar>
    246 
    247         <jar destfile="jettylib/jasper-runtime.jar" filesetmanifest="merge" >
    248             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
    249             <zipfileset src="${tomcat2.lib.small}/tomcat-coyote-util.jar" />
    250         </jar>
    251 <!--
    252         <jar destfile="jettylib/javax.servlet.jar" duplicate="preserve" filesetmanifest="mergewithoutmain" >
    253             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/servlet-api.jar" />
    254             <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/jsp-api.jar" />
    255             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-api.jar" />
    256             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-util.jar" />
    257         </jar>
    258 -->
    259         <!-- Ant bug, don't set update and filesetmanifest or the update doesn't happen,
    260              Their bug tracker claims fixed in 1.8.0 but broken for me in 1.8.1
    261           -->
     235        <!-- the javax.el API, AND the com.sun.el parser -->
     236        <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also -->
     237        <jar destfile="jettylib/commons-el.jar" >
     238          <!--
     239            Jetty version
     240            <zipfileset src="${jetty.base}/lib/jsp/javax.el-3.0.0.jar"/>
     241           -->
     242            <!-- Apache version -->
     243            <zipfileset src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-el-8.0.33.jar"/>
     244        </jar>
     245
     246        <!-- actually from jetty9, not tomcat8... this will fail unless we have the jetty files also -->
     247        <jar destfile="jettylib/jasper-runtime.jar" >
     248          <!--
     249            Jetty version
     250            <zipfileset src="${jetty.base}/lib/jsp/javax.servlet.jsp-2.3.2.jar"/>
     251            To be included in jasper-runtime.jar?
     252            Server complains "NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet" even with this included (but it still works).
     253            The following file has the class, but /usr/share/java/jetty8-jsp.jar is empty
     254            We don't use this one, because we want to be consistent with Debian builds that
     255            must use Apache (aka libtomcat8).
     256            <zipfileset excludes="about.html about_files about_files/* META-INF/ECLIPSEF.* META-INF/eclipse.inf plugin.properties" src="${jetty.base}/lib/jsp/jetty-jsp-${jetty.ver}.jar" />
     257           -->
     258            <!-- Apache version -->
     259            <!-- Also includes javax.servlet.jsp.*, this is copied into javax.servlet.jar above -->
     260            <zipfileset includes="org/**/*" src="${jetty.base}/lib/apache-jsp/org.mortbay.jasper.apache-jsp-8.0.33.jar"/>
     261            <!-- required Jetty initializer (see RouterConsoleRunner) -->
     262            <zipfileset src="${jetty.base}/lib/apache-jsp/org.eclipse.jetty.apache-jsp-${jetty.ver}.jar"/>
     263        </jar>
     264
    262265        <jar destfile="jettylib/commons-logging.jar" update="true" >
    263             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
     266            <manifest>
     267                <attribute name="Note" value="Intentionally empty" />
     268            </manifest>
    264269        </jar>
    265270    </target>
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    r072d990 r0703a29  
    264264        return "net.i2p.jetty.I2PLogger";
    265265    }
     266
     267    /**
     268     *  @since Jetty 9
     269     */
     270    public void debug(String msg, long arg) {
     271        debug(msg, Long.valueOf(arg), null);
     272    }
    266273}
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    r072d990 r0703a29  
    2525import javax.servlet.http.Cookie;
    2626
    27 import org.eclipse.jetty.http.HttpHeaders;
    2827import org.eclipse.jetty.http.PathMap;
    2928import org.eclipse.jetty.server.Request;
     
    8281    private transient OutputStream _fileOut;
    8382    private transient DateCache _logDateCache;
    84     private transient PathMap _ignorePathMap;
     83    private transient PathMap<String> _ignorePathMap;
    8584    private transient Writer _writer;
    8685    private transient ArrayList<Utf8StringBuilder> _buffers;
     
    287286                if (_preferProxiedForAddress)
    288287                {
    289                     addr = request.getHeader(HttpHeaders.X_FORWARDED_FOR);
     288                    addr = request.getHeader("X-Forwarded-For");
    290289                }
    291290
     
    311310                    buf.append(_logDateCache.format(request.getTimeStamp()));
    312311                else
    313                     buf.append(request.getTimeStampBuffer().toString());
     312                    //buf.append(request.getTimeStampBuffer().toString());
     313                    // TODO SimpleDateFormat or something
     314                    buf.append(request.getTimeStamp());
    314315                   
    315316                buf.append("] \"");
     
    359360                synchronized(_writer)
    360361                {
    361                     buf.append(StringUtil.__LINE_SEPARATOR);
     362                    buf.append(System.getProperty("line.separator", "\n"));
    362363                    int l=buf.length();
    363364                    if (l>_copy.length)
     
    413414                    }
    414415
    415                     _writer.write(StringUtil.__LINE_SEPARATOR);
     416                    _writer.write(System.getProperty("line.separator", "\n"));
    416417                    _writer.flush();
    417418                }
     
    430431                               Writer writer) throws IOException
    431432    {
    432         String referer = request.getHeader(HttpHeaders.REFERER);
     433        String referer = request.getHeader("Referer");
    433434        if (referer == null)
    434435            writer.write("\"-\" ");
     
    440441        }
    441442       
    442         String agent = request.getHeader(HttpHeaders.USER_AGENT);
     443        String agent = request.getHeader("User-Agent");
    443444        if (agent == null)
    444445            writer.write("\"-\" ");
     
    456457        if (_logDateFormat!=null)
    457458        {       
    458             _logDateCache = new DateCache(_logDateFormat, _logLocale);
    459             _logDateCache.setTimeZoneID(_logTimeZone);
     459            _logDateCache = new DateCache(_logDateFormat, _logLocale, _logTimeZone);
    460460        }
    461461       
     
    473473        if (_ignorePaths != null && _ignorePaths.length > 0)
    474474        {
    475             _ignorePathMap = new PathMap();
     475            _ignorePathMap = new PathMap<String>();
    476476            for (int i = 0; i < _ignorePaths.length; i++)
    477477                _ignorePathMap.put(_ignorePaths[i], _ignorePaths[i]);
  • apps/jetty/java/src/net/i2p/jetty/JettyStart.java

    r072d990 r0703a29  
    3131
    3232import org.eclipse.jetty.server.Connector;
     33import org.eclipse.jetty.server.NetworkConnector;
    3334import org.eclipse.jetty.server.Server;
    3435import org.eclipse.jetty.util.component.LifeCycle;
     
    131132                                Connector[] connectors = server.getConnectors();
    132133                                if (connectors.length > 0) {
    133                                     int port = connectors[0].getPort();
    134                                     if (port > 0) {
    135                                         _port = port;
    136                                         String host = connectors[0].getHost();
    137                                         if (host.equals("0.0.0.0") || host.equals("::"))
    138                                             host = "127.0.0.1";
    139                                         _context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
     134                                    Connector conn = connectors[0];
     135                                    if (conn instanceof NetworkConnector) {
     136                                        NetworkConnector nconn = (NetworkConnector) conn;
     137                                        int port = nconn.getPort();
     138                                        if (port > 0) {
     139                                            _port = port;
     140                                            String host = nconn.getHost();
     141                                            if (host.equals("0.0.0.0") || host.equals("::"))
     142                                                host = "127.0.0.1";
     143                                            _context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
     144                                        }
    140145                                    }
    141146                                }
Note: See TracChangeset for help on using the changeset viewer.