Changeset fccd0da for apps/jetty


Ignore:
Timestamp:
Dec 29, 2015 9:08:36 PM (5 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
3c383ca
Parents:
bb00e91 (diff), 2698076 (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 833ef88c125ba48423bc704701303ba55858336f)

to branch 'i2p.i2p.str4d.test2' (head 6f21d8d6c6d4cca5b6442f8effb56841e81a07b6)

Location:
apps/jetty
Files:
7 added
14 edited
21 moved

Legend:

Unmodified
Added
Removed
  • apps/jetty/.classpath

    rbb00e91 rfccd0da  
    1212        <classpathentry exported="true" kind="lib" path="jettylib/jetty-deploy.jar"/>
    1313        <classpathentry exported="true" kind="lib" path="jettylib/jetty-http.jar"/>
    14         <classpathentry exported="true" kind="lib" path="jettylib/jetty-i2p.jar"/>
    1514        <classpathentry exported="true" kind="lib" path="jettylib/jetty-io.jar"/>
    1615        <classpathentry exported="true" kind="lib" path="jettylib/jetty-java5-threadpool.jar"/>
  • apps/jetty/.externalToolBuilders/jetty-makejar.launch

    rbb00e91 rfccd0da  
    77<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
    88<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
     9<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
     10<listEntry value="/jetty"/>
     11</listAttribute>
     12<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
     13<listEntry value="4"/>
     14</listAttribute>
    915<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
    1016<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
  • apps/jetty/apache-tomcat-deployer/NOTICE

    rbb00e91 rfccd0da  
    11Apache Tomcat
    2 Copyright 1999-2014 The Apache Software Foundation
     2Copyright 1999-2015 The Apache Software Foundation
    33
    44This product includes software developed at
  • apps/jetty/apache-tomcat-deployer/README-i2p.txt

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

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

    rbb00e91 rfccd0da  
    22<project basedir="." default="all" name="jetty">
    33
    4     <property name="jetty.ver" value="8.1.15.v20140411" />
     4    <property name="jetty.ver" value="8.1.17.v20150415" />
    55    <property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
    6     <property name="jetty.sha1" value="41ec2b5e5605c038fb28d1f118669f06b4479e71" />
     6    <property name="jetty.sha1" value="ce7bcd1bdcdac4cf130467f6d55155b9e1517e71" />
    77    <property name="jetty.filename" value="${jetty.base}.zip" />
    88    <property name="jetty.url" value="http://download.eclipse.org/jetty/${jetty.ver}/dist/${jetty.filename}" />
     
    1111    <property name="javac.version" value="1.6" />
    1212    <property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
    13     <property name="tomcat.ver" value="6.0.41" />
     13    <property name="tomcat.ver" value="6.0.44" />
    1414    <property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
    1515    <property name="tomcat2.lib.small" value="apache-tomcat/lib" />
     
    150150             needed for old plugins and things. We add tomcat-juli below.
    151151          -->
     152      <!--
     153        * Removed in 0.9.24, see ticket #1679
     154        * Jetty now uses tomcat-juli (added below to commons-logging.jar), not commons-logging proper,
     155        * and no known plugins use it either.
    152156        <jar destfile="jettylib/commons-logging.jar" filesetmanifest="mergewithoutmain" >
    153157            <zipfileset excludes="META-INF/LICENSE.txt META-INF/NOTICE.txt" src="../../installer/lib/launch4j/lib/commons-logging.jar" />
    154158        </jar>
     159      -->
    155160        <ant target="copyTomcatLib" />
    156161    </target>
     
    278283        <!-- set if unset -->
    279284        <property name="workspace.changes.tr" value="" />
    280         <!-- old jetty 5 classes blow up the build if you forgot to do distclean -->
    281         <delete dir="build/obj/org" />
    282285        <copy todir="build/obj" file="resources/log4j.properties" />
    283286        <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class log4j.properties" >
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    rbb00e91 rfccd0da  
    103103            _log.warn(msg);
    104104        } else if (arg0 != null && arg1 == null && arg0 instanceof Throwable) {
    105             _log.error(msg, (Throwable) arg0);
     105            warn(msg, (Throwable) arg0);
    106106        } else if (_log.shouldLog(Log.WARN)) {
    107107            synchronized(_buffer) {
     
    114114    public void warn(String msg, Throwable th)
    115115    {
    116         // This doesn't cover ClassNotFoundException, etc.
    117         //if (th instanceof RuntimeException || th instanceof Error)
    118             _log.error(msg, th);
    119         //else
    120         //    _log.warn(msg,th);
     116        // some of these are serious, some aren't
     117        // no way to get it right
     118        if (th != null)
     119            _log.logAlways(Log.WARN, msg + ": " + th);
     120        else
     121            _log.logAlways(Log.WARN, msg);
    121122    }
    122123   
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    rbb00e91 rfccd0da  
    466466            _ignorePathMap = null;
    467467       
    468         _writer = new OutputStreamWriter(_out);
     468        _writer = new OutputStreamWriter(_out, "UTF-8");
    469469        _buffers = new ArrayList<Utf8StringBuilder>();
    470470        _copy = new char[1024];
  • apps/jetty/java/src/net/i2p/jetty/JettyStart.java

    rbb00e91 rfccd0da  
    1717// ========================================================================
    1818
     19import java.io.InputStream;
    1920import java.util.ArrayList;
    2021import java.util.Arrays;
     
    2627import net.i2p.app.*;
    2728import static net.i2p.app.ClientAppState.*;
    28 
     29import net.i2p.util.I2PAppThread;
     30import net.i2p.util.PortMapper;
     31
     32import org.eclipse.jetty.server.Connector;
     33import org.eclipse.jetty.server.Server;
    2934import org.eclipse.jetty.util.component.LifeCycle;
    3035import org.eclipse.jetty.util.resource.Resource;
     
    4550    private final String[] _args;
    4651    private final List<LifeCycle> _jettys;
     52    private final I2PAppContext _context;
    4753    private volatile ClientAppState _state;
     54    private volatile int _port;
    4855
    4956    /**
     
    5158     *  Does not support any of the other argument types from org.mortbay.start.Main.
    5259     *
    53      *  @param context unused, may be null
     60     *  @param context may be null
    5461     *  @param mgr may be null e.g. for use in plugins
    5562     */
     
    5966        _args = args;
    6067        _jettys = new ArrayList<LifeCycle>(args.length);
     68        _context = context;
    6169        parseArgs(args);
    6270        _state = INITIALIZED;
     
    6674     *  Modified from XmlConfiguration.main()
    6775     */
     76    @SuppressWarnings({"unchecked", "rawtypes"})
    6877    public void parseArgs(String[] args) throws Exception {
    6978        Properties properties=new Properties();
    7079        XmlConfiguration last=null;
     80        InputStream in = null;
    7181        for (int i = 0; i < args.length; i++) {
    7282            if (args[i].toLowerCase().endsWith(".properties")) {
    73                 properties.load(Resource.newResource(args[i]).getInputStream());
     83                in = Resource.newResource(args[i]).getInputStream();
     84                properties.load(in);
     85                in.close();
    7486            } else {
    7587                XmlConfiguration configuration = new XmlConfiguration(Resource.newResource(args[i]).getURL());
     
    89101    }
    90102
    91     public void startup() {
     103    public synchronized void startup() {
    92104        if (_state != INITIALIZED)
    93105            return;
     
    99111    }
    100112
    101     private class Starter extends Thread {
     113    private class Starter extends I2PAppThread {
    102114        public Starter() {
    103115            super("JettyStarter");
     
    113125                    try {
    114126                        lc.start();
     127                        if (_context != null && _context.portMapper().getPort(PortMapper.SVC_EEPSITE) <= 0) {
     128                            if (lc instanceof Server) {
     129                                Server server = (Server) lc;
     130                                Connector[] connectors = server.getConnectors();
     131                                if (connectors.length > 0) {
     132                                    int port = connectors[0].getPort();
     133                                    if (port > 0) {
     134                                        _port = port;
     135                                        String host = connectors[0].getHost();
     136                                        if (host.equals("0.0.0.0") || host.equals("::"))
     137                                            host = "127.0.0.1";
     138                                        _context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
     139                                    }
     140                                }
     141                            }
     142                        }
    115143                    } catch (Exception e) {
    116144                        changeState(START_FAILED, e);
     
    135163    }
    136164
    137     private class Stopper extends Thread {
     165    private class Stopper extends I2PAppThread {
    138166        public Stopper() {
    139167            super("JettyStopper");
     
    150178                    }
    151179                }
     180            }
     181            if (_context != null && _port > 0 && _context.portMapper().getPort(PortMapper.SVC_EEPSITE) == _port) {
     182                _port = 0;
     183                _context.portMapper().unregister(PortMapper.SVC_EEPSITE);
    152184            }
    153185            changeState(STOPPED);
  • apps/jetty/java/src/net/i2p/servlet/RequestWrapper.java

    rbb00e91 rfccd0da  
    2222 * $Revision: 1.3 $
    2323 */
    24 package i2p.susi.webmail;
     24package net.i2p.servlet;
    2525
    2626import java.io.IOException;
     
    4949 *  The filter would have been added in web.xml,
    5050 *  see that file, where it's commented out.
    51  *
    52  * @author user
     51 *  Filter isn't supported until Tomcat 7 (Servlet 3.0)
     52 *
     53 *  @author user
     54 *  @since 0.9.19 moved from susimail so it may be used by routerconsole too
    5355 */
    54 class RequestWrapper {
     56public class RequestWrapper {
    5557
    5658        private final HttpServletRequest httpRequest;
    57         private MultiPartRequest multiPartRequest;
     59        private final MultiPartRequest multiPartRequest;
    5860        private final Hashtable<String, String> cache;
    5961        private Hashtable<String, Integer> cachedParameterNames;
     
    6668                this.httpRequest = httpRequest;
    6769                String contentType = httpRequest.getContentType();
     70                MultiPartRequest mpr = null;
    6871                if( contentType != null && contentType.toLowerCase(Locale.US).startsWith( "multipart/form-data" ) ) {
    6972                        try {
    70                                 multiPartRequest = new MultiPartRequest( httpRequest );
     73                                mpr = new MultiPartRequest( httpRequest );
    7174                        } catch (IOException e) {
    7275                                // TODO Auto-generated catch block
     
    7477                        }
    7578                }
     79                multiPartRequest = mpr;
    7680        }
    7781
  • apps/jetty/java/src/org/mortbay/servlet/MultiPartRequest.java

    rbb00e91 rfccd0da  
    220220
    221221    /* ------------------------------------------------------------ */
     222    @SuppressWarnings("rawtypes")
    222223    public Hashtable[] getMultipleParams(String name)
    223224    {
     
    264265        // Get first boundary
    265266        String line = _in.readLine();
    266         if (!line.equals(_boundary))
     267        if (line == null || !line.equals(_boundary))
    267268        {
    268269            //log.warn(line);
  • apps/jetty/java/src/org/mortbay/util/ByteArrayPool.java

    rbb00e91 rfccd0da  
    1616package org.mortbay.util;
    1717
     18import java.util.concurrent.atomic.AtomicInteger;
    1819
    1920/* ------------------------------------------------------------ */
     
    2930        Integer.getInteger("org.mortbay.util.ByteArrayPool.pool_size",8).intValue();
    3031   
    31     public static final ThreadLocal __pools=new BAThreadLocal();
    32     public static int __slot;
     32    public static final ThreadLocal<byte[][]> __pools = new BAThreadLocal();
     33    public static final AtomicInteger __slot = new AtomicInteger();
    3334   
    3435    /* ------------------------------------------------------------ */
     
    3940    public static byte[] getByteArray(int size)
    4041    {
    41         byte[][] pool = (byte[][])__pools.get();
     42        byte[][] pool = __pools.get();
    4243        boolean full=true;
    4344        for (int i=pool.length;i-->0;)
     
    6364    public static byte[] getByteArrayAtLeast(int minSize)
    6465    {
    65         byte[][] pool = (byte[][])__pools.get();
     66        byte[][] pool = __pools.get();
    6667        for (int i=pool.length;i-->0;)
    6768        {
     
    8485            return;
    8586       
    86         byte[][] pool = (byte[][])__pools.get();
     87        byte[][] pool = __pools.get();
    8788        for (int i=pool.length;i-->0;)
    8889        {
     
    9596
    9697        // slot.
    97         int s = __slot++;
     98        int s = __slot.getAndIncrement();
    9899        if (s<0)s=-s;
    99100        pool[s%pool.length]=b;
     
    103104    /* ------------------------------------------------------------ */
    104105    /* ------------------------------------------------------------ */
    105     private static final class BAThreadLocal extends ThreadLocal
     106    private static final class BAThreadLocal extends ThreadLocal<byte[][]>
    106107    {
    107         protected Object initialValue()
     108        @Override
     109        protected byte[][] initialValue()
    108110            {
    109111                return new byte[__POOL_SIZE][];
Note: See TracChangeset for help on using the changeset viewer.