Changeset 92b9d0a


Ignore:
Timestamp:
Dec 23, 2011 12:56:48 AM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
99ad70e
Parents:
bd14dc3
Message:

First cut at migrating to Jetty 6 and prep for using an external
Jetty 6 package.

  • Add several jars from the Jetty 6 distribution
  • Update jetty.xml
  • Add context XML files
  • Update WorkingDir? to migrate the content XML files
  • Update RouterConsoleRunner? and LocaleWebAppHandler?
  • Remove all old Jetty 5.1.15 local mods; this will break Seedless using a custom Server() constructor
  • Update I2PRequestLog to be a mod of NCSARequestLog from 6.1.26
  • Put I2PRequestLog in its own jar
  • Copy MultiPartRequest? and other required classes from Jetty 5.1.15 and add it to susimail, as the replacement MultiPartFilter? in Jetty 6 is difficult to migrate to, and does not support content-type
  • Update i2psnark for Jetty 6
  • Disable i2psnark RunStandalone?, unused and instantiated Jetty 5
  • Fix up all webapp build.xml to reference new jars

Not yet working: Plugin/webapp run detection and stopping, eepsite CGI
Not well tested: Plugins, classpaths, webapps

Files:
4 added
9 deleted
21 edited
15 moved

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/build.xml

    rbd14dc3 r92b9d0a  
    2020                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
    2121                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
     22                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
    2223            </classpath>
    2324        </depend>
     
    3536            destdir="./build/obj"
    3637            includeAntRuntime="false"
    37             classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
     38            classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../jetty/jettylib/jetty-util.jar:../../ministreaming/java/build/mstreaming.jar" >
    3839            <compilerarg line="${javac.compilerargs}" />
    3940        </javac>
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    rbd14dc3 r92b9d0a  
    4444import org.klomp.snark.TrackerClient;
    4545
    46 import org.mortbay.http.HttpResponse;
    47 import org.mortbay.jetty.servlet.Default;
    48 import org.mortbay.util.Resource;
    49 import org.mortbay.util.URI;
     46import org.mortbay.jetty.servlet.DefaultServlet;
     47import org.mortbay.resource.Resource;
     48import org.mortbay.util.URIUtil;
    5049
    5150/**
     
    5453 *  often-blocked-by-the-browser file://
    5554 */
    56 public class I2PSnarkServlet extends Default {
     55public class I2PSnarkServlet extends DefaultServlet {
    5756    private I2PAppContext _context;
    5857    private Log _log;
     
    10099     */
    101100    @Override
    102     protected Resource getResource(String pathInContext) throws IOException
     101    public Resource getResource(String pathInContext)
    103102    {
    104103        if (pathInContext == null || pathInContext.equals("/") || pathInContext.equals("/index.jsp") ||
     
    106105            return super.getResource(pathInContext);
    107106        // files in the i2psnark/ directory
    108         return _resourceBase.addPath(pathInContext);
     107        try {
     108            return _resourceBase.addPath(pathInContext);
     109        } catch (IOException ioe) {
     110            throw new RuntimeException(ioe);
     111        }
    109112    }
    110113
     
    114117     */
    115118    @Override
    116     public void handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash) throws ServletException, IOException {
    117         if (resource.getName().startsWith("jar:file:"))
    118             response.setHeader("Cache-Control", "max-age=86400");  // cache for a day
    119         super.handleGet(request, response, pathInContext, resource, endsWithSlash);
     119    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     120////////////////////////////////////
     121        //if (resource.getName().startsWith("jar:file:"))
     122        //    response.setHeader("Cache-Control", "max-age=86400");  // cache for a day
     123        super.doGet(request, response);
    120124    }
    121125
     
    145149        String method = req.getMethod();
    146150        if (!(method.equals("GET") || method.equals("HEAD") || method.equals("POST"))) {
    147             resp.sendError(HttpResponse.__405_Method_Not_Allowed);
     151            resp.sendError(405);
    148152            return;
    149153        }
     
    158162                // bypass the horrid Resource.getListHTML()
    159163                String pathInfo = req.getPathInfo();
    160                 String pathInContext = URI.addPaths(path, pathInfo);
     164                String pathInContext = URIUtil.addPaths(path, pathInfo);
    161165                req.setCharacterEncoding("UTF-8");
    162166                resp.setCharacterEncoding("UTF-8");
     
    164168                Resource resource = getResource(pathInContext);
    165169                if (resource == null || (!resource.exists())) {
    166                     resp.sendError(HttpResponse.__404_Not_Found);
     170                    resp.sendError(404);
    167171                } else {
    168                     String base = URI.addPaths(req.getRequestURI(), "/");
     172                    String base = URIUtil.addPaths(req.getRequestURI(), "/");
    169173                    String listing = getListHTML(resource, base, true, method.equals("POST") ? req.getParameterMap() : null);
    170174                    if (listing != null)
    171175                        resp.getWriter().write(listing);
    172176                    else // shouldn't happen
    173                         resp.sendError(HttpResponse.__404_Not_Found);
     177                        resp.sendError(404);
    174178                }
    175179            } else {
     
    16811685        StringBuilder buf=new StringBuilder(4096);
    16821686        buf.append(DOCTYPE + "<HTML><HEAD><TITLE>");
    1683         String title = URI.decodePath(base);
     1687        String title = URIUtil.decodePath(base);
    16841688        if (title.startsWith("/i2psnark/"))
    16851689            title = title.substring("/i2psnark/".length());
     
    17841788        buf.append("</tr></thead>\n");
    17851789        buf.append("<tr><td colspan=\"" + (showPriority ? '4' : '3') + "\" class=\"ParentDir\"><A HREF=\"");
    1786         buf.append(URI.addPaths(base,"../"));
     1790        buf.append(URIUtil.addPaths(base,"../"));
    17871791        buf.append("\"><img alt=\"\" border=\"0\" src=\"" + _imgPath + "up.png\"> ")
    17881792            .append(_("Up to higher level directory")).append("</A></td></tr>\n");
     
    17941798        for (int i=0 ; i< ls.length ; i++)
    17951799        {   
    1796             String encoded=URI.encodePath(ls[i]);
     1800            String encoded=URIUtil.encodePath(ls[i]);
    17971801            // bugfix for I2P - Backport from Jetty 6 (zero file lengths and last-modified times)
    17981802            // http://jira.codehaus.org/browse/JETTY-361?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs
     
    18501854            }
    18511855
    1852             String path=URI.addPaths(base,encoded);
     1856            String path=URIUtil.addPaths(base,encoded);
    18531857            if (item.isDirectory() && !path.endsWith("/"))
    1854                 path=URI.addPaths(path,"/");
     1858                path=URIUtil.addPaths(path,"/");
    18551859            String icon = toIcon(item);
    18561860
  • apps/i2psnark/java/src/org/klomp/snark/web/RunStandalone.java

    rbd14dc3 r92b9d0a  
    3232            System.err.println("ERROR: Unable to create Jetty temporary work directory");
    3333       
     34        throw new RuntimeException("unsupported");
     35/****
    3436        try {
    3537            _server = new Server("jetty-i2psnark.xml");
     
    4042            e.printStackTrace();
    4143        }
     44****/
    4245    }
    4346   
    4447    public void stop() {
     48        throw new RuntimeException("unsupported");
     49/****
    4550        try {
    4651            _server.stop();
     
    4853            ie.printStackTrace();
    4954        }
     55****/
    5056    }
    5157}
  • apps/i2ptunnel/java/build.xml

    rbd14dc3 r92b9d0a  
    170170                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    171171                <pathelement location="../../jetty/jettylib/commons-el.jar" />
     172                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    172173                <pathelement location="../../jetty/jettylib/ant.jar" />
    173174                <pathelement location="build/i2ptunnel.jar" />
     
    191192                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    192193                <pathelement location="../../jetty/jettylib/commons-el.jar" />
     194                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    193195                <pathelement location="build/i2ptunnel.jar" />
    194196            </classpath>
  • apps/jetty/build.xml

    rbd14dc3 r92b9d0a  
    22<project basedir="." default="all" name="jetty">
    33
    4     <property name="jetty.base" value="jetty-5.1.15" />
    5     <property name="jetty.sha1" value="3a7a3de50f86f0cdb23c33aec632ea7f44132c5e" />
    6     <property name="jetty.filename" value="${jetty.base}.tgz" />
    7     <property name="jetty.url" value="http://dist.codehaus.org/jetty/jetty-5.1.x/${jetty.filename}" />
     4    <property name="jetty.ver" value="6.1.26" />
     5    <property name="jetty.base" value="jetty-${jetty.ver}" />
     6    <property name="jetty.sha1" value="9485913f1a1945a849a90f1a34853d22350bc524" />
     7    <property name="jetty.filename" value="${jetty.base}.zip" />
     8    <property name="jetty.url" value="http://dist.codehaus.org/jetty/${jetty.base}/${jetty.filename}" />
    89    <property name="verified.filename" value="verified.txt" />
    910    <property name="javac.compilerargs" value="" />
     
    6566
    6667    <target name="extractJettylib" unless="jetty.zip.extracted" >
     68      <!-- for .tgz -->
     69      <!--
    6770        <gunzip src="${jetty.filename}" dest="jetty.tar" />
    6871        <untar src="jetty.tar" dest="." />
     72      -->
     73      <!-- for .zip -->
     74        <unzip src="${jetty.filename}" dest="." />
    6975        <mkdir dir="jettylib" />
    70         <copy todir="jettylib" preservelastmodified="true" >
    71             <fileset dir="${jetty.base}/lib">
    72                 <include name="*.jar" />
    73             </fileset>
    74             <fileset dir="${jetty.base}/ext">
    75                 <include name="ant.jar" />
    76                 <include name="commons-el.jar" />
    77                 <include name="commons-logging.jar" />
    78                 <include name="jasper-compiler.jar" />
    79                 <include name="jasper-runtime.jar" />
    80             </fileset>
    81         </copy>
     76      <!-- We copy everything to names without the version numbers so we
     77           can update them later. Where there was something similar in Jetty 5,
     78           we use the same names.
     79           Reasons for inclusion:
     80              start.jar: Needed for clients.config startup of eepsites
     81              jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
     82              jetty-sslengine-xxx.jar: SSL NIO Connector for console
     83              jetty-java5-threadpool-xxx.jar: Concurrent thread pool for eepsite
     84              commons-logging.jar: JspC compiler
     85              TODO which of these are available in the Ubuntu packages?
     86        -->
     87        <copy preservelastmodified="true" file="${jetty.base}/lib/${jetty.base}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
     88        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
     89        <copy preservelastmodified="true" file="${jetty.base}/lib/servlet-api-2.5-20081211.jar" tofile="jettylib/javax.servlet.jar" />
     90        <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-sslengine-${jetty.ver}.jar" tofile="jettylib/jetty-sslengine.jar" />
     91        <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-java5-threadpool-${jetty.ver}.jar" tofile="jettylib/jetty-threadpool.jar" />
     92        <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/ant-1.6.5.jar" tofile="jettylib/ant.jar" />
     93        <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/commons-el-1.0.jar" tofile="jettylib/commons-el.jar" />
     94        <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-compiler-5.5.15.jar" tofile="jettylib/jasper-compiler.jar" />
     95        <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jasper-runtime-5.5.15.jar" tofile="jettylib/jasper-runtime.jar" />
     96        <copy preservelastmodified="true" file="${jetty.base}/lib/jsp-2.0/jsp-api-2.0.jar" tofile="jettylib/jsp-api.jar" />
     97        <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
    8298        <delete file="jetty.tar" />
    8399        <delete dir="${jetty.base}" />
     100        <!-- commons-logging.jar not in Jetty 6 but we have it in launch4j so copy it over, we need it
     101             for org.apache.jasper.JspC compiler
     102          -->
     103        <copy preservelastmodified="true" file="../../installer/lib/launch4j/lib/commons-logging.jar" todir="jettylib/" />
    84104    </target>
    85105
    86106    <target name="build" depends="jar" />
     107
    87108    <target name="builddep" />
    88109    <target name="compile" depends="builddep, ensureJettylib" >
     
    94115            destdir="./build/obj"
    95116            includeAntRuntime="false"
    96             classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar" >
     117            classpath="./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-util.jar" >
    97118            <compilerarg line="${javac.compilerargs}" />
    98119        </javac>
     
    113134    </target>
    114135
     136    <!-- With Jetty 5 we replaced classes in the jar, but with Jetty 6 we
     137         put our stuff in its own jar so we can work with standard Jetty 6 packages
     138      -->
    115139    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
    116140        <!-- set if unset -->
    117141        <property name="workspace.changes.tr" value="" />
    118         <jar destfile="./jettylib/org.mortbay.jetty.jar" basedir="./build/obj" includes="**/*.class" update="true" >
     142        <jar destfile="./jettylib/jetty-i2p.jar" basedir="./build/obj" includes="**/*.class" >
    119143            <manifest>
    120144                <attribute name="Build-Date" value="${build.timestamp}" />
  • apps/routerconsole/java/build.xml

    rbd14dc3 r92b9d0a  
    2222                <pathelement location="../../../router/java/build/obj" />
    2323                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
     24                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
     25                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
     26                <pathelement location="../../jetty/jettylib/jetty-threadpool.jar" />
    2427                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
     28                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    2529                <pathelement location="../../systray/java/build/obj" />
    2630                <pathelement location="../../systray/java/lib/systray4j.jar" />
     
    5458                <pathelement location="../../../router/java/build/router.jar" />
    5559                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
     60                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
     61                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
     62                <pathelement location="../../jetty/jettylib/jetty-threadpool.jar" />
    5663                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
     64                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    5765                <pathelement location="../../systray/java/build/systray.jar" />
    5866                <pathelement location="../../systray/java/lib/systray4j.jar" />
     
    234242                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
    235243                <pathelement location="../../jetty/jettylib/commons-el.jar" />
     244                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    236245                <pathelement location="../../jetty/jettylib/ant.jar" />
    237246                <pathelement location="../../systray/java/build/obj" />
     
    267276                <pathelement location="../../jetty/jettylib/commons-el.jar" />
    268277                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
     278                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
     279                <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
     280                <pathelement location="../../jetty/jettylib/jetty-threadpool.jar" />
     281                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
    269282                <pathelement location="../../systray/java/build/obj" />
    270283                <pathelement location="../../systray/java/lib/systray4j.jar" />
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java

    rbd14dc3 r92b9d0a  
    1515import net.i2p.router.startup.LoadClientAppsJob;
    1616
    17 import org.mortbay.jetty.Server;
     17import org.mortbay.jetty.handler.ContextHandlerCollection;
    1818
    1919/**
     
    287287     */
    288288    private void startWebApp(String app) {
    289         Server s = WebAppStarter.getConsoleServer();
     289        ContextHandlerCollection s = WebAppStarter.getConsoleServer();
    290290        if (s != null) {
    291291                    try {
  • apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java

    rbd14dc3 r92b9d0a  
    55import java.util.Map;
    66
     7import javax.servlet.ServletException;
     8import javax.servlet.http.HttpServletRequest;
     9import javax.servlet.http.HttpServletResponse;
     10
    711import net.i2p.I2PAppContext;
    812
    9 import org.mortbay.http.HttpRequest;
    10 import org.mortbay.http.HttpResponse;
    11 import org.mortbay.jetty.servlet.WebApplicationHandler;
     13import org.mortbay.jetty.webapp.WebAppContext;
    1214
    1315/**
     
    2022 * @author zzz
    2123 */
    22 public class LocaleWebAppHandler extends WebApplicationHandler
     24public class LocaleWebAppHandler extends WebAppContext
    2325{
    2426    private final I2PAppContext _context;
    2527
    26     public LocaleWebAppHandler(I2PAppContext ctx) {
    27         super();
     28    public LocaleWebAppHandler(I2PAppContext ctx, String path, String warPath) {
     29        super(warPath, path);
    2830        _context = ctx;
    2931    }
     
    3739    @Override
    3840    public void handle(String pathInContext,
    39                        String pathParams,
    40                        HttpRequest httpRequest,
    41                        HttpResponse httpResponse)
    42          throws IOException
     41                       HttpServletRequest httpRequest,
     42                       HttpServletResponse httpResponse,
     43                       int dispatch)
     44         throws IOException, ServletException
    4345    {
    4446        // Handle OPTIONS (nothing to override)
    45         if (HttpRequest.__OPTIONS.equals(httpRequest.getMethod()))
     47        if ("OPTIONS".equals(httpRequest.getMethod()))
    4648        {
    4749            handleOptions(httpRequest, httpResponse);
     
    7577                    String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
    7678                    // Do we have a servlet for the new path that isn't the catchall *.jsp?
    77                     Map.Entry servlet = getHolderEntry(testPath);
     79                    //Map.Entry servlet = getHolderEntry(testPath);
     80///////////////////////////////
     81                    Map.Entry servlet = null;
    7882                    if (servlet != null) {
    7983                        String servletPath = (String) servlet.getKey();
     
    8892        }
    8993        //System.err.println("New path: " + newPath);
    90         super.handle(newPath, pathParams, httpRequest, httpResponse);
     94        super.handle(newPath, httpRequest, httpResponse, dispatch);
    9195        //System.err.println("Was handled? " + httpRequest.isHandled());
    9296    }
     
    96100     *  @since 0.8
    97101     */
     102/****  not in Jetty 6
    98103    @Override
    99     public void handleTrace(HttpRequest request,
    100                             HttpResponse response)
     104    public void handleTrace(HttpServletRequest request,
     105                            HttpServletResponse response)
    101106        throws IOException
    102107    {
    103         response.sendError(HttpResponse.__405_Method_Not_Allowed);
     108        response.sendError(405);
    104109    }
     110****/
    105111
    106112    /**
     
    108114     *  @since 0.8
    109115     */
    110     public void handleOptions(HttpRequest request,
    111                               HttpResponse response)
     116    public void handleOptions(HttpServletRequest request,
     117                              HttpServletResponse response)
    112118        throws IOException
    113119    {
    114         response.sendError(HttpResponse.__405_Method_Not_Allowed);
     120        response.sendError(405);
    115121    }
    116122}
  • apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java

    rbd14dc3 r92b9d0a  
    66import net.i2p.util.FileUtil;
    77
    8 import org.mortbay.http.Version;
     8import org.mortbay.jetty.Server;
    99
    1010public class LogsHelper extends HelperBase {
     
    1313    /** @since 0.8.11 */
    1414    public String getJettyVersion() {
    15         return Version.getImplVersion();
     15        return Server.getVersion();
    1616    }
    1717
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    rbd14dc3 r92b9d0a  
    2929import net.i2p.util.Translate;
    3030
    31 import org.mortbay.jetty.Server;
     31import org.mortbay.jetty.handler.ContextHandlerCollection;
    3232
    3333
     
    121121
    122122        // start console webapps in console/webapps
    123         Server server = WebAppStarter.getConsoleServer();
     123        ContextHandlerCollection server = WebAppStarter.getConsoleServer();
    124124        if (server != null) {
    125125            File consoleDir = new File(pluginDir, "console");
     
    222222
    223223        // stop console webapps in console/webapps
    224         Server server = WebAppStarter.getConsoleServer();
    225         if (server != null) {
     224        //ContextHandlerCollection server = WebAppStarter.getConsoleServer();
     225        //if (server != null) {
    226226        /*
    227227            File consoleDir = new File(pluginDir, "console");
     
    243243                while (wars.hasNext()) {
    244244                    String warName = wars.next();
    245                     WebAppStarter.stopWebApp(server, warName);
     245                    WebAppStarter.stopWebApp(warName);
    246246                }
    247247                pluginWars.get(appName).clear();
    248248            }
    249         }
     249        //}
    250250
    251251        // remove summary bar link
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    rbd14dc3 r92b9d0a  
    1010import java.util.Properties;
    1111import java.util.StringTokenizer;
     12import java.util.concurrent.TimeUnit;
    1213
    1314import net.i2p.I2PAppContext;
     
    2526import net.i2p.util.VersionComparator;
    2627
    27 import org.mortbay.http.DigestAuthenticator;
    28 import org.mortbay.http.HashUserRealm;
    29 import org.mortbay.http.NCSARequestLog;
    30 import org.mortbay.http.SecurityConstraint;
    31 import org.mortbay.http.SocketListener;
    32 import org.mortbay.http.SslListener;
    33 import org.mortbay.http.handler.SecurityHandler;
     28import org.mortbay.jetty.AbstractConnector;
     29import org.mortbay.jetty.Connector;
     30import org.mortbay.jetty.Handler;
     31import org.mortbay.jetty.NCSARequestLog;
    3432import org.mortbay.jetty.Server;
    35 import org.mortbay.jetty.servlet.WebApplicationContext;
    36 import org.mortbay.jetty.servlet.WebApplicationHandler;
    37 import org.mortbay.util.InetAddrPort;
    38 
     33import org.mortbay.jetty.handler.ContextHandlerCollection;
     34import org.mortbay.jetty.handler.DefaultHandler;
     35import org.mortbay.jetty.handler.HandlerCollection;
     36import org.mortbay.jetty.handler.RequestLogHandler;
     37import org.mortbay.jetty.nio.SelectChannelConnector;
     38import org.mortbay.jetty.security.DigestAuthenticator;
     39import org.mortbay.jetty.security.HashUserRealm;
     40import org.mortbay.jetty.security.Constraint;
     41import org.mortbay.jetty.security.ConstraintMapping;
     42import org.mortbay.jetty.security.SecurityHandler;
     43import org.mortbay.jetty.security.SslSelectChannelConnector;
     44import org.mortbay.jetty.servlet.ServletHandler;
     45import org.mortbay.jetty.servlet.SessionHandler;
     46import org.mortbay.jetty.webapp.WebAppContext;
     47import org.mortbay.thread.QueuedThreadPool;
     48import org.mortbay.thread.concurrent.ThreadPool;
     49
     50/**
     51 *  Start the router console.
     52 */
    3953public class RouterConsoleRunner {
    40     private Server _server;
     54    private static Server _server;
    4155    private String _listenPort;
    4256    private String _listenHost;
     
    4458    private String _sslListenHost;
    4559    private String _webAppsDir;
     60
    4661    private static final String PROP_WEBAPP_CONFIG_FILENAME = "router.webappsConfigFile";
    4762    private static final String DEFAULT_WEBAPP_CONFIG_FILENAME = "webapps.config";
     
    5873    private static final String USAGE = "Bad RouterConsoleRunner arguments, check clientApp.0.args in your clients.config file! " +
    5974                                        "Usage: [[port host[,host]] [-s sslPort [host[,host]]] [webAppsDir]]";
     75
     76    private static final int MIN_THREADS = 1;
     77    private static final int MAX_THREADS = 24;
     78    private static final int MAX_IDLE_TIME = 90*1000;
    6079   
    6180    static {
     
    136155    }
    137156   
     157    /**
     158     *  SInce _server is now static
     159     *  @return may be null or stopped perhaps
     160     *  @since Jetty 6 since it doesn't have Server.getServers()
     161     */
     162    static Server getConsoleServer() {
     163        return _server;
     164    }
     165
    138166    private static void startTrayApp() {
    139167        try {
     
    159187    }
    160188
     189    /**
     190     *  http://irc.codehaus.org/display/JETTY/Porting+to+jetty6
     191     *
     192     *<pre>
     193     *  Server
     194     *          HandlerCollection
     195     *                  ContextHandlerCollection
     196     *                          WebAppContext (i.e. ContextHandler)
     197     *                                  SessionHandler
     198     *                                  SecurityHandler
     199     *                                  ServletHandler
     200     *                          WebAppContext
     201     *                          ...
     202     *                  DefaultHandler
     203     *                  RequestLogHandler (opt)
     204     *</pre>
     205     */
    161206    public void startConsole() {
    162207        File workDir = new SecureDirectory(I2PAppContext.getGlobalContext().getTempDir(), "jetty-work");
     
    172217        _server = new Server();
    173218
     219    /**** this doesn't work with NIO maybe?
     220        try {
     221            _server.setThreadPool(new ThreadPool(MIN_THREADS, MAX_THREADS, MAX_IDLE_TIME, TimeUnit.MILLISECONDS));
     222        } catch (Throwable t) {
     223            // class not found...
     224            System.out.println("INFO: Jetty concurrent ThreadPool unavailable, using QueuedThreadPool");
     225            QueuedThreadPool qtp = new QueuedThreadPool(MAX_THREADS);
     226            qtp.setMinThreads(MIN_THREADS);
     227            qtp.setMaxIdleTimeMs(MAX_IDLE_TIME);
     228            _server.setThreadPool(qtp);
     229        }
     230     ****/
     231        HandlerCollection hColl = new HandlerCollection();
     232        ContextHandlerCollection chColl = new ContextHandlerCollection();
     233        _server.addHandler(hColl);
     234        hColl.addHandler(chColl);
     235        hColl.addHandler(new DefaultHandler());
     236
    174237        String log = I2PAppContext.getGlobalContext().getProperty("routerconsole.log");
    175238        if (log != null) {
     
    178241                logFile = new File(I2PAppContext.getGlobalContext().getLogDir(), "logs/" + log);
    179242            try {
    180                 _server.setRequestLog(new NCSARequestLog(logFile.getAbsolutePath()));
    181             } catch (IOException ioe) {
     243                RequestLogHandler rhl = new RequestLogHandler();
     244                rhl.setRequestLog(new NCSARequestLog(logFile.getAbsolutePath()));
     245                hColl.addHandler(rhl);
     246            } catch (Exception ioe) {
    182247                System.err.println("ERROR: Unable to create Jetty log: " + ioe);
    183248            }
     
    203268
    204269        List<String> notStarted = new ArrayList();
    205         WebApplicationHandler baseHandler = null;
     270        WebAppContext baseHandler = null;
    206271        try {
    207272            int boundAddresses = 0;
     
    218283                        //else
    219284                        //    _server.addListener(host + ':' + _listenPort);
    220                         InetAddrPort iap = new InetAddrPort(host, lport);
    221                         SocketListener lsnr = new SocketListener(iap);
    222                         lsnr.setMinThreads(1);           // default 2
    223                         lsnr.setMaxThreads(24);          // default 256
    224                         lsnr.setMaxIdleTimeMs(90*1000);  // default 10 sec
     285                        // Use AbstractConnector instead of Connector so we can do setName()
     286                        AbstractConnector lsnr = new SelectChannelConnector();
     287                        lsnr.setHost(host);
     288                        lsnr.setPort(lport);
     289                        lsnr.setMaxIdleTime(90*1000);  // default 10 sec
    225290                        lsnr.setName("ConsoleSocket");   // all with same name will use the same thread pool
    226                         _server.addListener(lsnr);
     291                        _server.addConnector(lsnr);
    227292                        boundAddresses++;
    228293                    } catch (NumberFormatException nfe) {
    229294                        System.err.println("Unable to bind routerconsole to " + host + " port " + _listenPort + ' ' + nfe);
    230                     } catch (IOException ioe) { // this doesn't seem to work, exceptions don't happen until start() below
     295                    } catch (Exception ioe) { // this doesn't seem to work, exceptions don't happen until start() below
    231296                        System.err.println("Unable to bind routerconsole to " + host + " port " + _listenPort + ' ' + ioe);
    232297                    }
     
    253318                        String host = tok.nextToken().trim();
    254319                        // doing it this way means we don't have to escape an IPv6 host with []
    255                         InetAddrPort iap = new InetAddrPort(host, sslPort);
    256320                        try {
    257                             SslListener ssll = new SslListener(iap);
     321                            // TODO if class not found use SslChannelConnector
     322                            // Sadly there's no common base class with the ssl methods in it
     323                            SslSelectChannelConnector ssll = new SslSelectChannelConnector();
     324                            ssll.setHost(host);
     325                            ssll.setPort(sslPort);
    258326                            // the keystore path and password
    259327                            ssll.setKeystore(keyStore.getAbsolutePath());
     
    261329                            // the X.509 cert password (if not present, verifyKeyStore() returned false)
    262330                            ssll.setKeyPassword(ctx.getProperty(PROP_KEY_PASSWORD, "thisWontWork"));
    263                             ssll.setMinThreads(1);           // default 2
    264                             ssll.setMaxThreads(24);          // default 256
    265                             ssll.setMaxIdleTimeMs(90*1000);  // default 10 sec
     331                            ssll.setMaxIdleTime(90*1000);  // default 10 sec
    266332                            ssll.setName("ConsoleSocket");   // all with same name will use the same thread pool
    267                             _server.addListener(ssll);
     333                            _server.addConnector(ssll);
    268334                            boundAddresses++;
    269335                        } catch (Exception e) {   // probably no exceptions at this point
     
    281347                return;
    282348            }
    283             _server.setRootWebApp(ROUTERCONSOLE);
    284             WebApplicationContext wac = _server.addWebApplication("/", _webAppsDir + ROUTERCONSOLE + ".war");
     349
     350            baseHandler = new LocaleWebAppHandler(I2PAppContext.getGlobalContext(),
     351                                                  "/", _webAppsDir + ROUTERCONSOLE + ".war");
    285352            File tmpdir = new SecureDirectory(workDir, ROUTERCONSOLE + "-" +
    286353                                                       (_listenPort != null ? _listenPort : _sslListenPort));
    287354            tmpdir.mkdir();
    288             wac.setTempDirectory(tmpdir);
    289             baseHandler = new LocaleWebAppHandler(I2PAppContext.getGlobalContext());
    290             wac.addHandler(0, baseHandler);
    291             initialize(wac);
     355            baseHandler.setTempDirectory(tmpdir);
     356            baseHandler.setSessionHandler(new SessionHandler());
     357            baseHandler.setServletHandler(new ServletHandler());
     358            initialize(baseHandler);
     359            chColl.addHandler(baseHandler);
     360
    292361            File dir = new File(_webAppsDir);
    293362            String fileNames[] = dir.list(WarFilenameFilter.instance());
     
    301370                            tmpdir = new SecureDirectory(workDir, appName + "-" +
    302371                                                                  (_listenPort != null ? _listenPort : _sslListenPort));
    303                             WebAppStarter.addWebApp(I2PAppContext.getGlobalContext(), _server, appName, path, tmpdir);
     372                            WebAppStarter.addWebApp(I2PAppContext.getGlobalContext(), chColl, appName, path, tmpdir);
    304373
    305374                            if (enabled == null) {
     
    316385                }
    317386            }
    318         } catch (IOException ioe) {
     387        } catch (Exception ioe) {
    319388            ioe.printStackTrace();
    320389        }
     390
    321391        if (rewrite)
    322392            storeWebAppProperties(props);
    323393        try {
     394            // start does a mapContexts()
    324395            _server.start();
    325396        } catch (Throwable me) {
     
    338409            for (int i = 0; i < notStarted.size(); i++) {
    339410                try {
    340                      baseHandler.mapPathToServlet('/' + notStarted.get(i) + "/*",
    341                                                   "net.i2p.router.web.jsp.nowebapp_jsp");
     411/////////////////////////////////////////////////
     412                     //baseHandler.mapPathToServlet('/' + notStarted.get(i) + "/*",
     413                     //                             "net.i2p.router.web.jsp.nowebapp_jsp");
    342414                } catch (Throwable me) {
    343415                     System.err.println(me);
     
    455527    }
    456528
    457     static void initialize(WebApplicationContext context) {
     529    static void initialize(WebAppContext context) {
     530        SecurityHandler sec = new SecurityHandler();
     531        List<ConstraintMapping> constraints = new ArrayList(4);
    458532        String password = getPassword();
    459533        if (password != null) {
     
    461535            realm.put("admin", password);
    462536            realm.addUserToRole("admin", "routerAdmin");
    463             context.setRealm(realm);
    464             context.setAuthenticator(authenticator);
    465             context.addHandler(0, new SecurityHandler());
    466             SecurityConstraint constraint = new SecurityConstraint("admin", "routerAdmin");
     537            sec.setUserRealm(realm);
     538            sec.setAuthenticator(authenticator);
     539            Constraint constraint = new Constraint("admin", "routerAdmin");
    467540            constraint.setAuthenticate(true);
    468             context.addSecurityConstraint("/", constraint);
     541            ConstraintMapping cm = new ConstraintMapping();
     542            cm.setConstraint(constraint);
     543            cm.setPathSpec("/");
     544            constraints.add(cm);
    469545        }
    470546
     
    478554        // See also:
    479555        // http://old.nabble.com/Disable-HTTP-TRACE-in-Jetty-5.x-td12412607.html
    480         SecurityConstraint sc = new SecurityConstraint();
    481         sc.setName("No trace or options");
    482         sc.addMethod("TRACE");
    483         sc.addMethod("OPTIONS");
    484         sc.setAuthenticate(true);
    485         context.addSecurityConstraint("/*", sc) ;
     556
     557        Constraint sc = new Constraint();
     558        sc.setName("No trace");
     559        ConstraintMapping cm = new ConstraintMapping();
     560        cm.setMethod("TRACE");
     561        cm.setConstraint(sc);
     562        cm.setPathSpec("/");
     563        constraints.add(cm);
     564
     565        sc = new Constraint();
     566        sc.setName("No options");
     567        cm = new ConstraintMapping();
     568        cm.setMethod("OPTIONS");
     569        cm.setConstraint(sc);
     570        cm.setPathSpec("/");
     571        constraints.add(cm);
     572
     573        ConstraintMapping cmarr[] = constraints.toArray(new ConstraintMapping[constraints.size()]);
     574        sec.setConstraintMappings(cmarr);
     575
     576        context.setSecurityHandler(sec);
    486577    }
    487578   
     
    508599   
    509600    /** @since 0.8.8 */
    510     private class ServerShutdown implements Runnable {
     601    private static class ServerShutdown implements Runnable {
    511602        public void run() {
    512603            try {
    513604                _server.stop();
    514             } catch (InterruptedException ie) {}
     605            } catch (Exception ie) {}
    515606        }
    516607    }
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    rbd14dc3 r92b9d0a  
    77import net.i2p.I2PAppContext;
    88
    9 import org.mortbay.jetty.servlet.WebApplicationContext;
     9import org.mortbay.jetty.webapp.Configuration;
     10import org.mortbay.jetty.webapp.WebAppContext;
    1011
    1112
     
    3233 *  @author zzz
    3334 */
    34 public class WebAppConfiguration implements WebApplicationContext.Configuration {
    35     private WebApplicationContext _wac;
     35public class WebAppConfiguration implements Configuration {
     36    private WebAppContext _wac;
    3637
    3738    private static final String CLASSPATH = ".classpath";
    3839
    39     public void setWebApplicationContext(WebApplicationContext context) {
     40    public void setWebAppContext(WebAppContext context) {
    4041       _wac = context;
    4142    }
    4243
    43     public WebApplicationContext getWebApplicationContext() {
     44    public WebAppContext getWebAppContext() {
    4445        return _wac;
    4546    }
     
    8889                path = dir.getAbsolutePath() + '/' + elem;
    8990            System.err.println("Adding " + path + " to classpath for " + appName);
    90             _wac.addClassPath(path);
     91            _wac.setExtraClasspath(path);
    9192        }
    9293    }
     
    9495    public void configureDefaults() {}
    9596    public void configureWebApp() {}
     97
     98    /** @since Jetty 6 */
     99    public void deconfigureWebApp() {}
     100
     101    /** @since Jetty 6 */
     102    public void configureClassLoader() {}
    96103}
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java

    rbd14dc3 r92b9d0a  
    1515import net.i2p.util.PortMapper;
    1616
    17 import org.mortbay.http.HttpContext;
    18 import org.mortbay.http.HttpListener;
     17import org.mortbay.jetty.Connector;
     18import org.mortbay.jetty.Handler;
    1919import org.mortbay.jetty.Server;
    20 import org.mortbay.jetty.servlet.WebApplicationContext;
     20import org.mortbay.jetty.webapp.WebAppContext;
     21import org.mortbay.jetty.handler.ContextHandler;
     22import org.mortbay.jetty.handler.ContextHandlerCollection;
    2123
    2224
     
    5052     *  @throws just about anything, caller would be wise to catch Throwable
    5153     */
    52     static void startWebApp(I2PAppContext ctx, Server server, String appName, String warPath) throws Exception {
     54    static void startWebApp(I2PAppContext ctx, ContextHandlerCollection server,
     55                            String appName, String warPath) throws Exception {
    5356         File tmpdir = new SecureDirectory(ctx.getTempDir(), "jetty-work-" + appName + ctx.random().nextInt());
    54          WebApplicationContext wac = addWebApp(ctx, server, appName, warPath, tmpdir);     
     57         WebAppContext wac = addWebApp(ctx, server, appName, warPath, tmpdir);     
    5558                 _log.debug("Loading war from: " + warPath);
    5659         wac.start();
     
    6265     *  and then starts all at once.
    6366     */
    64     static WebApplicationContext addWebApp(I2PAppContext ctx, Server server, String appName, String warPath, File tmpdir) throws IOException {
     67    static WebAppContext addWebApp(I2PAppContext ctx, ContextHandlerCollection server,
     68                                   String appName, String warPath, File tmpdir) throws IOException {
    6569
    6670        // Jetty will happily load one context on top of another without stopping
    6771        // the first one, so we remove any previous one here
    6872        try {
    69             stopWebApp(server, appName);
     73            stopWebApp(appName);
    7074        } catch (Throwable t) {}
    7175
     
    9296        }
    9397
    94         WebApplicationContext wac = server.addWebApplication("/"+ appName, warPath);
     98        WebAppContext wac = new WebAppContext(warPath, "/"+ appName);
    9599        tmpdir.mkdir();
    96100        wac.setTempDirectory(tmpdir);
     
    102106
    103107        // see WebAppConfiguration for info
    104         String[] classNames = server.getWebApplicationConfigurationClassNames();
     108        String[] classNames = wac.getConfigurationClasses();
    105109        String[] newClassNames = new String[classNames.length + 1];
    106110        for (int j = 0; j < classNames.length; j++)
    107111             newClassNames[j] = classNames[j];
    108112        newClassNames[classNames.length] = WebAppConfiguration.class.getName();
    109         wac.setConfigurationClassNames(newClassNames);
     113        wac.setConfigurationClasses(newClassNames);
     114        server.addHandler(wac);
     115        server.mapContexts();
    110116        return wac;
    111117    }
     
    115121     *  @throws just about anything, caller would be wise to catch Throwable
    116122     */
    117     static void stopWebApp(Server server, String appName) {
    118         // this will return a new context if one does not exist
    119         HttpContext wac = server.getContext('/' + appName);
     123    static void stopWebApp(String appName) {
     124        ContextHandler wac = getWebApp(appName);
     125        if (wac == null)
     126            return;
    120127        try {
    121             // false -> not graceful
    122             wac.stop(false);
    123         } catch (InterruptedException ie) {}
     128            // not graceful is default in Jetty 6?
     129            wac.stop();
     130        } catch (Exception ie) {}
     131        ContextHandlerCollection server = getConsoleServer();
     132        if (server == null)
     133            return;
    124134        try {
    125             server.removeContext(wac);
     135            server.removeHandler(wac);
     136            server.mapContexts();
    126137        } catch (IllegalStateException ise) {}
    127138    }
    128139
    129140    static boolean isWebAppRunning(String appName) {
    130         Server server = WebAppStarter.getConsoleServer();
    131         if (server == null)
     141        ContextHandler wac = getWebApp(appName);
     142        if (wac == null)
    132143            return false;
    133         // this will return a new context if one does not exist
    134         HttpContext wac = server.getContext('/' + appName);
    135144        return wac.isStarted();
    136145    }
    137146   
    138     /** see comments in ConfigClientsHandler */
    139     static Server getConsoleServer() {
    140         Collection c = Server.getHttpServers();
    141         for (int i = 0; i < c.size(); i++) {
    142             Server s = (Server) c.toArray()[i];
    143             HttpListener[] hl = s.getListeners();
    144             for (int j = 0; j < hl.length; j++) {
    145                 if (hl[j].getPort() == I2PAppContext.getGlobalContext().portMapper().getPort(PortMapper.SVC_CONSOLE))
    146                     return s;
    147             }
     147    /** @since Jetty 6 */
     148    static ContextHandler getWebApp(String appName) {
     149        ContextHandlerCollection server = getConsoleServer();
     150        if (server == null)
     151            return null;
     152        Handler handlers[] = server.getHandlers();
     153        if (handlers == null)
     154            return null;
     155        String path = '/'+ appName;
     156        for (int i = 0; i < handlers.length; i++) {
     157            ContextHandler ch = (ContextHandler) handlers[i];
     158            if (appName.equals(ch.getContextPath()))
     159                return ch;
    148160        }
    149161        return null;
    150162    }
     163
     164    /** see comments in ConfigClientsHandler */
     165    static ContextHandlerCollection getConsoleServer() {
     166        Server s = RouterConsoleRunner.getConsoleServer();
     167        if (s == null)
     168            return null;
     169        Handler h = s.getChildHandlerByClass(ContextHandlerCollection.class);
     170        if (h == null)
     171            return null;
     172        return (ContextHandlerCollection) h;
     173    }
    151174}
  • apps/susidns/src/build.xml

    rbd14dc3 r92b9d0a  
    1818        <pathelement location="${lib}/jasper-runtime.jar" />
    1919        <pathelement location="${lib}/javax.servlet.jar" />
     20        <pathelement location="${lib}/jsp-api.jar" />
    2021        <pathelement location="${lib}/commons-logging.jar" />
    2122        <pathelement location="${lib}/commons-el.jar" />
  • apps/susimail/build.xml

    rbd14dc3 r92b9d0a  
    2020                <pathelement location="../jetty/jettylib/javax.servlet.jar" />
    2121                <pathelement location="../jetty/jettylib/org.mortbay.jetty.jar" />
     22                <pathelement location="../jetty/jettylib/jetty-util.jar" />
    2223                <pathelement location="../../core/java/build/i2p.jar" />
    2324            </classpath>
  • apps/susimail/src/WEB-INF/web.xml

    rbd14dc3 r92b9d0a  
    1616    <session-timeout>15</session-timeout>
    1717  </session-config>
    18 </web-app>
     18
     19<!--
     20     Jetty 6 mulipart form handling
     21     See http://docs.codehaus.org/display/JETTY/File+Upload+in+jetty6
     22     and RequestWrapper.java.
     23     Unused because it doesn't support content-type until Jetty 8.
     24
     25    <filter>
     26        <filter-name>fileuploadfilter</filter-name>
     27        <filter-class>org.mortbay.servlet.MultiPartFilter</filter-class>
     28        <init-param>
     29            <param-name>deleteFiles</param-name>
     30            <param-value>true</param-value>
     31        </init-param>
     32    </filter>
     33
     34    <filter-mapping>
     35        <filter-name>fileuploadfilter</filter-name>
     36        <url-pattern>/susimail</url-pattern>
     37    </filter-mapping>
     38-->
     39
     40-</web-app>
  • apps/susimail/src/src/i2p/susi/webmail/RequestWrapper.java

    rbd14dc3 r92b9d0a  
    3636
    3737/**
     38 *  Required major changes for Jetty 6
     39 *  to support change from MultiPartRequest to MultiPartFilter.
     40 *  See http://docs.codehaus.org/display/JETTY/File+Upload+in+jetty6
     41 *  Unfortunately, Content-type not available until Jetty 8
     42 *  See https://bugs.eclipse.org/bugs/show_bug.cgi?id=349110
     43 *
     44 *  So we could either extend and fix MultiPartFilter, and rewrite everything here,
     45 *  or copy MultiParRequest into our war and fix it so it compiles with Jetty 6.
     46 *  We do the latter.
     47 *
     48 *  The filter would have been added in web.xml,
     49 *  see that file, where it's commented out.
     50 *
    3851 * @author user
    3952 */
  • build.properties

    rbd14dc3 r92b9d0a  
    1111# Note: Include the trailing slash! Don't surround the URL in quotes!
    1212javasedocs.url=http://docs.oracle.com/javase/6/docs/api/
    13 jettydocs.url=http://docs.i2p2.de/jetty/javadoc/
     13jettydocs.url=http://jetty.codehaus.org/jetty/jetty-6/apidocs/
    1414jrobindocs.url=http://docs.i2p-projekt.de/jrobin/javadoc/
    1515wrapperdocs.url=http://wrapper.tanukisoftware.com/jdoc/
  • build.xml

    rbd14dc3 r92b9d0a  
    195195        <copy file="apps/routerconsole/java/build/routerconsole.jar" todir="build/" />
    196196        <copy file="apps/routerconsole/java/build/routerconsole.war" todir="build/" />
    197         <copy file="apps/jetty/jettylib/org.mortbay.jetty.jar" todir="build/" />
    198         <copy file="apps/jetty/jettylib/jasper-compiler.jar" todir="build/" />
    199         <copy file="apps/jetty/jettylib/jasper-runtime.jar" todir="build/" />
    200         <copy file="apps/jetty/jettylib/commons-logging.jar" todir="build/" />
    201         <copy file="apps/jetty/jettylib/commons-el.jar" todir="build/" />
    202         <copy file="apps/jetty/jettylib/javax.servlet.jar" todir="build/" />
     197        <copy todir="build/" >
     198            <fileset dir="apps/jetty/jettylib" excludes="ant.jar" />
     199        </copy>
    203200    </target>
    204201
     
    392389            <group title="I2PSnark Application" packages="org.klomp.snark:org.klomp.snark.*" />
    393390            <group title="I2PTunnel Application" packages="net.i2p.i2ptunnel:net.i2p.i2ptunnel.*" />
     391            <group title="Jetty Logging" packages="org.mortbay.http" />
    394392            <group title="SAM Bridge" packages="net.i2p.sam:net.i2p.sam.client" />
    395393            <group title="SusiDNS Application" packages="i2p.susi.dns" />
    396             <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util" />
     394            <group title="SusiMail Application" packages="i2p.susi.webmail:i2p.susi.webmail.*:i2p.susi.debug:i2p.susi.util:org.mortbay.servlet:org.mortbay.util" />
    397395            <group title="Systray Application" packages="net.i2p.apps.systray" />
    398396            <sourcepath>
     
    413411                <pathelement location="apps/susidns/src/java/src" />
    414412                <pathelement location="apps/susimail/src/src" />
     413                <pathelement location="apps/jetty/java/src" />
    415414            </sourcepath>
    416415            <classpath>
    417416                <pathelement location="apps/jetty/jettylib/org.mortbay.jetty.jar" />
    418417                <pathelement location="apps/jetty/jettylib/javax.servlet.jar" />
     418                <pathelement location="apps/jetty/jettylib/jetty-sslengine.jar" />
     419                <pathelement location="apps/jetty/jettylib/jetty-start.jar" />
     420                <pathelement location="apps/jetty/jettylib/jetty-threadpool.jar" />
     421                <pathelement location="apps/jetty/jettylib/jetty-util.jar" />
     422                <pathelement location="apps/jetty/jettylib/jsp-api.jar" />
    419423                <pathelement location="apps/systray/java/lib/systray4j.jar" />
    420424                <pathelement location="apps/jrobin/jrobin-1.5.9.1.jar" />
     
    671675        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
    672676        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
    673         <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
    674         <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
    675         <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
    676         <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
    677         <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
     677        <!-- all jetty stuff -->
     678        <copy todir="pkg-temp/lib" >
     679            <fileset dir="build" includes="commons*.jar jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.jetty.jar" />
     680        </copy>
    678681        <copy file="build/mstreaming.jar" todir="pkg-temp/lib/" />
    679682        <copy file="build/streaming.jar" todir="pkg-temp/lib/" />
    680         <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
    681683        <copy file="build/router.jar" todir="pkg-temp/lib/" />
    682684        <copy file="build/desktopgui.jar" todir="pkg-temp/lib/" />
     
    725727        <!-- Eepsite stuff here -->
    726728        <mkdir dir="pkg-temp/eepsite" />
    727         <mkdir dir="pkg-temp/eepsite/webapps" />
    728         <mkdir dir="pkg-temp/eepsite/logs" />
    729         <mkdir dir="pkg-temp/eepsite/cgi-bin" />
    730         <mkdir dir="pkg-temp/eepsite/docroot" />
    731         <mkdir dir="pkg-temp/eepsite/docroot/help" />
    732         <mkdir dir="pkg-temp/eepsite/docroot/help/lib" />
    733         <copy todir="pkg-temp/eepsite/docroot/" >
    734             <fileset dir="installer/resources/eepsite.help/" />
     729        <copy todir="pkg-temp/eepsite/" >
     730            <fileset dir="installer/resources/eepsite/" />
    735731        </copy>
    736732        <copy todir="pkg-temp/eepsite/docroot/help/lib/" >
     
    738734        </copy>
    739735        <copy file="installer/resources/themes/console/images/favicon.ico" tofile="pkg-temp/eepsite/docroot/favicon.ico" />
    740         <copy file="installer/resources/jetty.xml" tofile="pkg-temp/eepsite/jetty.xml" />
    741736    </target>
    742737
     
    932927    </target>
    933928
     929    <!-- All jetty jars required for update.
     930         We don't need commons-el or commons-logging, they haven't changed.
     931         TODO do we need to bother updating jasper?
     932         TODO where is JMX? We don't need it I hope.
     933      -->
    934934    <target name="prepjupdate" depends="prepupdate, buildWEB">
    935         <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
    936         <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
    937         <copy file="build/commons-logging.jar" todir="pkg-temp/lib/" />
    938         <copy file="build/commons-el.jar" todir="pkg-temp/lib/" />
    939         <copy file="build/javax.servlet.jar" todir="pkg-temp/lib/" />
    940         <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
    941     </target>
     935        <copy todir="pkg-temp" >
     936            <fileset dir="build/lib" includes="jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.jetty.jar" />
     937        </copy>
     938    </target>
     939
     940    <!-- just our jetty 5 fixes, not for jetty 6 -->
    942941    <target name="prepjupdatefixes" depends="prepupdate, buildWEB">
    943942        <copy file="build/org.mortbay.jetty.jar" todir="pkg-temp/lib/" />
  • installer/resources/clients.config

    rbd14dc3 r92b9d0a  
    4141
    4242# run our own eepsite with a seperate jetty instance
    43 clientApp.3.main=org.mortbay.jetty.Server
     43clientApp.3.main=org.mortbay.start.Main
    4444clientApp.3.name=I2P webserver (eepsite)
    4545clientApp.3.args="eepsite/jetty.xml"
  • router/java/src/net/i2p/router/startup/WorkingDir.java

    rbd14dc3 r92b9d0a  
    148148        boolean success = migrate(MIGRATE_BASE, oldDirf, dirf);
    149149        // this one must be after MIGRATE_BASE
    150         success &= migrateJettyXml(oldDirf, dirf);
     150        success &= migrateJettyXml(oldDirf, dirf, "jetty.xml");
     151        success &= migrateJettyXml(oldDirf, dirf, "contexts/base-context.xml");
     152        success &= migrateJettyXml(oldDirf, dirf, "contexts/cgi-context.xml");
    151153        success &= migrateClientsConfig(oldDirf, dirf);
    152154        // for later news.xml updates (we don't copy initialNews.xml over anymore)
     
    259261     *  do it again with modifications.
    260262     */
    261     private static boolean migrateJettyXml(File olddir, File todir) {
     263    private static boolean migrateJettyXml(File olddir, File todir, String filename) {
    262264        File eepsite1 = new File(olddir, "eepsite");
    263         File oldFile = new File(eepsite1, "jetty.xml");
     265        File oldFile = new File(eepsite1, filename);
    264266        File eepsite2 = new File(todir, "eepsite");
    265         File newFile = new File(eepsite2, "jetty.xml");
     267        File newFile = new File(eepsite2, filename);
    266268        FileInputStream in = null;
    267269        PrintWriter out = null;
     
    277279            }
    278280            out.println("<!-- Modified by I2P User dir migration script -->");
    279             System.err.println("Copied jetty.xml with modifications");
     281            System.err.println("Copied " + filename + " with modifications");
    280282            return true;
    281283        } catch (IOException ioe) {
    282284            if (in != null) {
    283                 System.err.println("FAILED copy jetty.xml");
     285                System.err.println("FAILED copy " + filename);
    284286                return false;
    285287            }
Note: See TracChangeset for help on using the changeset viewer.