Changeset 2270c47 for apps/jetty


Ignore:
Timestamp:
Jul 10, 2016 2:31:03 PM (4 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
6468e9e
Parents:
0bfe45be (diff), 03de374 (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 34802d93f1d32368153a6769608d8e1046d0d117)

to branch 'i2p.i2p.str4d.test2' (head 0981aa4b9874c1752456cbf381aadc2fe829d57b)

Location:
apps/jetty
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • apps/jetty/build.xml

    r0bfe45be r2270c47  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<project basedir="." default="all" name="jetty">
     3
     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     -->
    315
    416    <property name="jetty.ver" value="8.1.17.v20150415" />
     
    2335     -->
    2436
    25     <target name="ensureJettylib" >
    26         <available property="jetty.zip.extracted" file="${jetty.base}" type="dir" />
     37    <!-- verify everything we need is in jettylib/ -->
     38    <target name="ensureJettylib" depends="ensureJettylib1, copyJettylib" />
     39
     40    <target name="ensureJettylib1" >
     41        <condition property="jetty.zip.extracted" >
     42            <or>
     43                <istrue value="${with-libjetty8-java}" />
     44                <available file="${jetty.base}" type="dir" />
     45            </or>
     46        </condition>
    2747        <condition property="jetty.zip.available" >
    2848            <or>
     
    3151            </or>
    3252        </condition>
    33         <ant target="copyJettylib" />
    34     </target>
     53        <condition property="verified.already" >
     54            <or>
     55                <istrue value="${with-libjetty8-java}" />
     56                <istrue value="${jetty.zip.extracted}" />
     57                <and>
     58                    <available file="${jetty.filename}" />
     59                    <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
     60                </and>
     61            </or>
     62        </condition>
     63    </target>
     64
    3565  <!--
    3666    <target name="ensureJettylib" depends="extractJettylib" />
     
    6191    </target>
    6292
    63     <condition property="verified.already" >
    64         <or>
    65             <istrue value="${jetty.zip.extracted}" />
    66             <and>
    67                 <available file="${jetty.filename}" />
    68                 <uptodate property="foo.bar.baz" srcfile="${jetty.filename}" targetfile="${verified.filename}" />
    69             </and>
    70         </or>
    71     </condition>
    72 
    7393    <target name="verifyJettylib" depends="fetchJettylib" unless="verified.already" >
    7494        <condition property="jetty.zip.verified" >
     
    95115    </target>
    96116
    97     <target name="copyJettylib" depends="extractJettylib" >
     117    <target name="mkJettylibdir" >
    98118        <mkdir dir="jettylib" />
     119    </target>
     120
     121    <!-- Jetty and tomcat files -->
     122    <target name="copyJettylib" depends="mkJettylibdir, copyJettylib1, copyTomcatLib" />
     123
     124    <!-- Jetty files only -->
     125    <target name="copyJettylib1" depends="extractJettylib" unless="${with-libjetty8-java}" >
    99126      <!-- We copy everything to names without the version numbers so we
    100127           can update them later. Where there was something similar in Jetty 5/6,
     
    158185        </jar>
    159186      -->
    160         <ant target="copyTomcatLib" />
    161187    </target>
    162188
     
    170196         with the JspC compiler jasper-runtime.jar below.
    171197     -->
    172     <target name="buildTomcatUtilJar" >
     198    <target name="buildTomcatUtilJar" unless="${with-libservlet2.5-java}" >
    173199        <!-- take only what we need from the tomcat-coyote jar -->
    174200        <jar destfile="${tomcat2.lib.small}/tomcat-coyote-util.jar" >
     
    193219         tomcat-api.jar + tomcat-util.jar: Add to javax.servlet.jar (as of Tomcat 7 / Jetty 8)
    194220     -->
    195     <target name="copyTomcatLib" >
     221    <target name="copyTomcatLib" depends="mkJettylibdir, copyTomcatLib1, copyTomcatLib2, copyTomcatLib3" />
     222
     223    <target name="copyTomcatLib1" unless="${with-libservlet2.5-java}" >
     224        <condition property="with-libtomcat-java" >
     225            <or>
     226                <istrue value="${with-libtomcat6-java}" />
     227                <istrue value="${with-libtomcat7-java}" />
     228            </or>
     229        </condition>
     230    </target>
     231
     232
     233    <target name="copyTomcatLib2" unless="${with-libtomcat-java}" >
     234        <!-- EL libs.
     235             Tomcat 6 has EL 2.1.
     236             Tomcat 7 / libservlet3.0 has EL 2.2.
     237             According to http://stackoverflow.com/questions/7202686/differences-between-el-2-1-and-2-2
     238             2.2 is backwards-compatible with 2.1.
     239         -->
     240        <jar destfile="jettylib/commons-el.jar" duplicate="preserve" filesetmanifest="merge" >
     241            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper-el.jar" />
     242            <zipfileset excludes="META-INF/**/*" src="${tomcat.lib}/el-api.jar" />
     243        </jar>
     244
    196245        <jar destfile="jettylib/jasper-runtime.jar" filesetmanifest="merge" >
    197246            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/jasper.jar" />
    198247            <zipfileset src="${tomcat2.lib.small}/tomcat-coyote-util.jar" />
    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" />
    203248        </jar>
    204249<!--
     
    216261            <zipfileset excludes="META-INF/LICENSE META-INF/NOTICE" src="${tomcat.lib}/tomcat-juli.jar" />
    217262        </jar>
     263    </target>
     264
     265    <target name="copyTomcatLib3" unless="${with-libtomcat-java}" >
    218266        <jar destfile="jettylib/jasper-compiler.jar" >
    219267            <manifest>
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    r0bfe45be r2270c47  
    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

    r0bfe45be r2270c47  
    7777    private boolean _logCookies = false;
    7878    private boolean _logServer = false;
     79    private boolean _b64;
    7980   
    8081    private transient OutputStream _out;
     
    241242    {
    242243        _preferProxiedForAddress = preferProxiedForAddress;
     244    }
     245
     246    /**
     247     * @param b64 true to enable base 64 logging. False for base 32 logging. Default false.
     248     * @since 0.9.24
     249     */
     250    public void setB64(boolean b64)
     251    {
     252        _b64 = b64;
    243253    }
    244254
     
    281291
    282292                if (addr == null) {
    283                     // TODO offer B32 option
    284                     addr = request.getHeader("X-I2P-DestHash");
    285                     if(addr != null)
    286                         addr += ".i2p";
    287                     else
     293                    if (_b64) {
     294                        addr = request.getHeader("X-I2P-DestHash");
     295                        if (addr != null)
     296                            addr += ".i2p";
     297                    } else {
     298                        // 52chars.b32.i2p
     299                        addr = request.getHeader("X-I2P-DestB32");
     300                    }
     301                    if (addr == null)
    288302                        addr = request.getRemoteAddr();
    289303                }
Note: See TracChangeset for help on using the changeset viewer.