Changeset c66559f for apps/jetty


Ignore:
Timestamp:
Jan 19, 2017 5:19:00 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1a28a2a
Parents:
994b51b (diff), e47c628 (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' (head d2e954c054d89a425c9791067ac7998433e95a23)

to branch 'i2p.i2p.zzz.jetty9' (head adcba23cab31b88e430ee09bf45fd1b6789a1719)

Location:
apps/jetty
Files:
14 added
13 deleted
16 edited
3 moved

Legend:

Unmodified
Added
Removed
  • apps/jetty/apache-tomcat-deployer/NOTICE

    r994b51b rc66559f  
    11Apache Tomcat
    2 Copyright 1999-2015 The Apache Software Foundation
     2Copyright 1999-2016 The Apache Software Foundation
    33
    44This product includes software developed at
     
    66
    77The Windows Installer is built with the Nullsoft
    8 Scriptable Install Sysem (NSIS), which is
     8Scriptable Install System (NSIS), which is
    99open source software.  The original software and
    1010related information is available at
    1111http://nsis.sourceforge.net.
    1212
    13 Java compilation software for JSP pages is provided by Eclipse,
    14 which is open source software.  The original software and
    15 related information is available at
    16 http://www.eclipse.org.
     13Java compilation software for JSP pages is provided by the Eclipse
     14JDT Core Batch Compiler component, which is open source software.
     15The original software and related information is available at
     16http://www.eclipse.org/jdt/core/.
    1717
    1818The original XML Schemas for Java EE Deployment Descriptors:
  • apps/jetty/apache-tomcat-deployer/README-i2p.txt

    r994b51b rc66559f  
    33
    44Retrieved from the file
    5         apache-tomcat-6.0.44-deployer.tar.gz
     5        apache-tomcat-6.0.48-deployer.tar.gz
    66
    77minus the following files and directores:
  • apps/jetty/apache-tomcat/README-i2p.txt

    r994b51b rc66559f  
    22
    33Retrieved from the file
    4         apache-tomcat-6.0.44.tar.gz
     4        apache-tomcat-6.0.48.tar.gz
    55
    66containing only a small subset of lib/tomcat-coyote.jar.
  • apps/jetty/build.xml

    r994b51b rc66559f  
    22<project basedir="." default="all" name="jetty">
    33
     4    <!-- This copies jars, with some modifications and renaming,
     5         from the jetty-distribution directory to the jettylib directory.
     6         This is disabled if the property with-libjetty8-java=true.
     7
     8         This copies jars, with some modifications and renaming,
     9         from the apache-tomcat-deployer and apache-tomcat directories to the jettylib directory.
     10         This is disabled if the property with-libservlet2.5-java=true.
     11
     12         This also builds the small helper jar jetty-i2p.jar from
     13         the source in the java/ directory.
     14     -->
     15
     16    <!-- Note: Please change all references in top-level build.xml if you update to a new Jetty! -->
    417    <!-- unused until we go to 9.3 -->
    518    <property name="jetty.branch" value="stable-9" />
     
    1225    <property name="verified.filename" value="verified.txt" />
    1326    <property name="javac.compilerargs" value="" />
    14     <property name="javac.version" value="1.6" />
     27    <property name="javac.version" value="1.7" />
    1528    <property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
    16     <property name="tomcat.ver" value="6.0.44" />
     29    <property name="tomcat.ver" value="6.0.48" />
    1730    <property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
    1831    <property name="tomcat2.lib.small" value="apache-tomcat/lib" />
     
    2639     -->
    2740
    28     <target name="ensureJettylib" >
    29         <available property="jetty.zip.extracted" file="${jetty.base}" type="dir" />
     41    <!-- verify everything we need is in jettylib/ -->
     42    <target name="ensureJettylib" depends="ensureJettylib1, copyJettylib" />
     43
     44    <target name="ensureJettylib1" >
     45        <condition property="jetty.zip.extracted" >
     46            <or>
     47                <istrue value="${with-libjetty8-java}" />
     48                <available file="${jetty.base}" type="dir" />
     49            </or>
     50        </condition>
    3051        <condition property="jetty.zip.available" >
    3152            <or>
     
    3455            </or>
    3556        </condition>
    36         <ant target="copyJettylib" />
    37     </target>
     57        <condition property="verified.already" >
     58            <or>
     59                <istrue value="${with-libjetty8-java}" />
     60                <istrue value="${jetty.zip.extracted}" />
     61                <and>
     62                    <available file="${jetty.filename}" />
     63                    <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
     64                </and>
     65            </or>
     66        </condition>
     67    </target>
     68
    3869  <!--
    3970    <target name="ensureJettylib" depends="extractJettylib" />
     
    6495    </target>
    6596
    66     <condition property="verified.already" >
    67         <or>
    68             <istrue value="${jetty.zip.extracted}" />
    69             <and>
    70                 <available file="${jetty.filename}" />
    71                 <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
    72             </and>
    73         </or>
    74     </condition>
    75 
    7697    <target name="verifyJettylib" depends="fetchJettylib" unless="verified.already" >
    7798        <condition property="jetty.zip.verified" >
     
    98119    </target>
    99120
    100     <target name="copyJettylib" depends="extractJettylib" >
     121    <target name="mkJettylibdir" >
    101122        <mkdir dir="jettylib" />
     123    </target>
     124
     125    <!-- Jetty and tomcat files -->
     126    <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib" />
     127
     128    <!-- Jetty files only -->
     129    <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty8-java}" >
    102130      <!-- We copy everything to names without the version numbers so we
    103131           can update them later. Where there was something similar in Jetty 5/6,
     
    154182             needed for old plugins and things. We add tomcat-juli below.
    155183          -->
     184      <!--
     185        * Removed in 0.9.24, see ticket #1679
     186        * Jetty now uses tomcat-juli (added below to commons-logging.jar), not commons-logging proper,
     187        * and no known plugins use it either.
    156188        <jar destfile="jettylib/commons-logging.jar" filesetmanifest="mergewithoutmain" >
    157189            <zipfileset excludes="META-INF/LICENSE.txt META-INF/NOTICE.txt" src="../../installer/lib/launch4j/lib/commons-logging.jar" />
    158190        </jar>
    159         <ant target="copyTomcatLib" />
     191      -->
    160192    </target>
    161193
     
    169201         with the JspC compiler jasper-runtime.jar below.
    170202     -->
    171     <target name="buildTomcatUtilJar" >
     203    <target name="buildTomcatUtilJar" unless="${with-libservlet2.5-java}" >
    172204        <!-- take only what we need from the tomcat-coyote jar -->
    173205        <jar destfile="${tomcat2.lib.small}/tomcat-coyote-util.jar" >
     
    192224         tomcat-api.jar + tomcat-util.jar: Add to javax.servlet.jar (as of Tomcat 7 / Jetty 8)
    193225     -->
    194     <target name="copyTomcatLib" >
     226    <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" />
     227
     228    <target name="copyTomcatLib1" unless="${with-libservlet2.5-java}" >
     229        <condition property="with-libtomcat-java" >
     230            <or>
     231                <istrue value="${with-libtomcat6-java}" />
     232                <istrue value="${with-libtomcat7-java}" />
     233                <istrue value="${with-libtomcat8-java}" />
     234            </or>
     235        </condition>
     236    </target>
     237
     238
     239    <target name="copyTomcatLib2" unless="${with-libtomcat-java}" >
     240        <!-- EL libs.
     241             Tomcat 6 has EL 2.1.
     242             Tomcat 7 / libservlet3.0 has EL 2.2.
     243             According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2
     244             2.2 is backwards-compatible with 2.1.
     245         -->
     246        <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
     247            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
     248            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
     249        </jar>
     250
    195251        <jar destfile="jettylib/jasper-runtime.jar" >
    196252            <manifest>
    197253                <attribute name="Note" value="Intentionally empty" />
    198254            </manifest>
    199         </jar>
    200         <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
    201             <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
    202             <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
    203255        </jar>
    204256<!--
     
    216268            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
    217269        </jar>
     270    </target>
     271
     272    <target name="copyTomcatLib3" unless="${with-libtomcat-java}" >
    218273        <jar destfile="jettylib/jasper-compiler.jar" >
    219274            <manifest>
     
    292347                <attribute name="Class-Path" value="jetty-deploy.jar jetty-xml.jar" />
    293348                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
     349                <attribute name="X-Compile-Source-JDK" value="${javac.version}" />
     350                <attribute name="X-Compile-Target-JDK" value="${javac.version}" />
    294351            </manifest>
    295352        </jar>
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    r994b51b rc66559f  
    3232    private final Log _log;
    3333   
    34     StringBuilder _buffer = new StringBuilder();
    35    
    36     static {
     34    private final StringBuilder _buffer = new StringBuilder();
     35   
     36    //static {
    3737        // So people don't wonder where the logs went
    38         System.out.println("INFO: Jetty " + Server.getVersion() + " logging to I2P logs using class " + Server.class.getName());
    39     }
     38        //System.out.println("INFO: Jetty " + Server.getVersion() + " logging to I2P logs using class " + Server.class.getName());
     39    //}
    4040
    4141    public I2PLogger()
     
    116116        // some of these are serious, some aren't
    117117        // no way to get it right
    118         if (th != null)
    119             _log.logAlways(Log.WARN, msg + ": " + th);
    120         else
     118        if (th != null) {
     119            if (_log.shouldLog(Log.WARN))
     120                _log.warn(msg, th);
     121            else
     122                _log.logAlways(Log.WARN, msg + ": " + th);
     123        } else {
    121124            _log.logAlways(Log.WARN, msg);
     125        }
    122126    }
    123127   
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    r994b51b rc66559f  
    7676    private boolean _logCookies = false;
    7777    private boolean _logServer = false;
     78    private boolean _b64;
    7879   
    7980    private transient OutputStream _out;
     
    240241    {
    241242        _preferProxiedForAddress = preferProxiedForAddress;
     243    }
     244
     245    /**
     246     * @param b64 true to enable base 64 logging. False for base 32 logging. Default false.
     247     * @since 0.9.24
     248     */
     249    public void setB64(boolean b64)
     250    {
     251        _b64 = b64;
    242252    }
    243253
     
    280290
    281291                if (addr == null) {
    282                     // TODO offer B32 option
    283                     addr = request.getHeader("X-I2P-DestHash");
    284                     if(addr != null)
    285                         addr += ".i2p";
    286                     else
     292                    if (_b64) {
     293                        addr = request.getHeader("X-I2P-DestHash");
     294                        if (addr != null)
     295                            addr += ".i2p";
     296                    } else {
     297                        // 52chars.b32.i2p
     298                        addr = request.getHeader("X-I2P-DestB32");
     299                    }
     300                    if (addr == null)
    287301                        addr = request.getRemoteAddr();
    288302                }
  • apps/jetty/java/src/net/i2p/jetty/JettyStart.java

    r994b51b rc66559f  
    2727import net.i2p.app.*;
    2828import static net.i2p.app.ClientAppState.*;
     29import net.i2p.util.I2PAppThread;
    2930import net.i2p.util.PortMapper;
    3031
     
    3940 *  Start Jetty where the args are one or more XML files.
    4041 *  Save a reference to the Server so it can be cleanly stopped later.
     42 *  Caller must call startup()
    4143 *
    4244 *  This is like XmlConfiguration.main(), which is essentially what
     
    7476     *  Modified from XmlConfiguration.main()
    7577     */
     78    @SuppressWarnings({"unchecked", "rawtypes"})
    7679    public void parseArgs(String[] args) throws Exception {
    7780        Properties properties=new Properties();
     
    100103    }
    101104
    102     public void startup() {
     105    public synchronized void startup() {
    103106        if (_state != INITIALIZED)
    104107            return;
     
    110113    }
    111114
    112     private class Starter extends Thread {
     115    private class Starter extends I2PAppThread {
    113116        public Starter() {
    114117            super("JettyStarter");
     
    166169    }
    167170
    168     private class Stopper extends Thread {
     171    private class Stopper extends I2PAppThread {
    169172        public Stopper() {
    170173            super("JettyStopper");
     
    219222    public static void main(String[] args) {
    220223        try {
    221             new JettyStart(null, null, args);
     224            JettyStart js = new JettyStart(null, null, args);
     225            js.startup();
    222226        } catch (RuntimeException e) {
    223227            throw e;
  • apps/jetty/java/src/net/i2p/servlet/RequestWrapper.java

    r994b51b rc66559f  
    140140                                if( key.toLowerCase(Locale.US).compareToIgnoreCase( "content-type") == 0 ) {
    141141                                        String value = e.getValue();
    142                                         int i = value.indexOf( ";" );
     142                                        int i = value.indexOf( ';' );
    143143                                        if( i != -1 )
    144144                                                result = value.substring( 0, i );
  • apps/jetty/java/src/net/i2p/servlet/filters/XSSRequestWrapper.java

    r994b51b rc66559f  
    8585     */
    8686    @Override
    87     public Map getParameterMap() {
    88         Map rv = new HashMap();
    89         for (Enumeration keys = getParameterNames(); keys.hasMoreElements(); ) {
    90              String k = (String) keys.nextElement();
     87    public Map<String, String[]> getParameterMap() {
     88        Map<String, String[]> rv = new HashMap<String, String[]>();
     89        for (Enumeration<String> keys = getParameterNames(); keys.hasMoreElements(); ) {
     90             String k = keys.nextElement();
    9191             String[] v = getParameterValues(k);
    9292             if (v != null)
  • apps/jetty/java/src/org/mortbay/servlet/MultiPartRequest.java

    r994b51b rc66559f  
    220220
    221221    /* ------------------------------------------------------------ */
     222    @SuppressWarnings("rawtypes")
    222223    public Hashtable[] getMultipleParams(String name)
    223224    {
  • apps/jetty/java/src/org/mortbay/util/ByteArrayPool.java

    r994b51b rc66559f  
    3030        Integer.getInteger("org.mortbay.util.ByteArrayPool.pool_size",8).intValue();
    3131   
    32     public static final ThreadLocal __pools=new BAThreadLocal();
     32    public static final ThreadLocal<byte[][]> __pools = new BAThreadLocal();
    3333    public static final AtomicInteger __slot = new AtomicInteger();
    3434   
     
    4040    public static byte[] getByteArray(int size)
    4141    {
    42         byte[][] pool = (byte[][])__pools.get();
     42        byte[][] pool = __pools.get();
    4343        boolean full=true;
    4444        for (int i=pool.length;i-->0;)
     
    6464    public static byte[] getByteArrayAtLeast(int minSize)
    6565    {
    66         byte[][] pool = (byte[][])__pools.get();
     66        byte[][] pool = __pools.get();
    6767        for (int i=pool.length;i-->0;)
    6868        {
     
    8585            return;
    8686       
    87         byte[][] pool = (byte[][])__pools.get();
     87        byte[][] pool = __pools.get();
    8888        for (int i=pool.length;i-->0;)
    8989        {
     
    104104    /* ------------------------------------------------------------ */
    105105    /* ------------------------------------------------------------ */
    106     private static final class BAThreadLocal extends ThreadLocal
     106    private static final class BAThreadLocal extends ThreadLocal<byte[][]>
    107107    {
    108         protected Object initialValue()
     108        @Override
     109        protected byte[][] initialValue()
    109110            {
    110111                return new byte[__POOL_SIZE][];
Note: See TracChangeset for help on using the changeset viewer.