Changeset 56eba28a


Ignore:
Timestamp:
Apr 7, 2013 1:33:13 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9478a84
Parents:
8857fe5 (diff), f8d323b (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 d30ab8d5835ca55d63913342f0d28169c88e5d77)

to branch 'i2p.i2p.zzz.jetty7' (head fdd1d82c4bb26ed934170c34dd803c342a183a91)

Files:
8 added
9 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • LICENSE.txt

    r8857fe5 r56eba28a  
    178178   See licenses/LICENSE-GPLv2.txt
    179179
    180    Jetty 6.1.26:
    181    Copyright 1995-2009 Mort Bay Consulting Pty Ltd
    182    See licenses/LICENSE-Jetty.txt
    183    See licenses/LICENSE-Apache2.0.txt
     180   Jetty 7.6.8.v20121106:
     181   See licenses/ABOUT-Jetty.html
     182   See licenses/NOTICE-Jetty.html
     183   See licenses/LICENSE-Apache2.0.txt
     184   See licenses/LICENSE-ECLIPSE-1.0.html
    184185   See licenses/NOTICE-Commons-Logging.txt
    185186
  • apps/i2psnark/java/build.xml

    r8857fe5 r56eba28a  
    2020                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
    2121                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
     22                <pathelement location="../../jetty/jettylib/jetty-servlet.jar" />
    2223                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
    2324            </classpath>
     
    3940            destdir="./build/obj"
    4041            includeAntRuntime="false"
    41             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" >
     42            classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../jetty/jettylib/jetty-servlet.jar:../../jetty/jettylib/jetty-util.jar:../../ministreaming/java/build/mstreaming.jar" >
    4243            <compilerarg line="${javac.compilerargs}" />
    4344        </javac>
     
    104105            <fileset dir="../icons/" />
    105106        </copy>
     107        <!-- mime.properties must be in with the classes -->
     108        <copy file="../mime.properties" todir="build/obj/org/klomp/snark/web" />
    106109        <war destfile="../i2psnark.war" webxml="../web.xml" >
    107110          <!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
    108           <classes dir="./build/obj" includes="**/web/*.class" />
     111          <classes dir="./build/obj" includes="**/web/*" />
    109112            <fileset dir="build/icons/" />
    110113            <manifest>
  • apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java

    r8857fe5 r56eba28a  
    5050    private final I2PAppContext _context;
    5151    private final Log _log;
     52    private final String _baseName;
    5253   
    5354    private boolean _shouldProxy;
     
    8384
    8485    public I2PSnarkUtil(I2PAppContext ctx) {
     86        this(ctx, "i2psnark");
     87    }
     88
     89    /**
     90     *  @param baseName generally "i2psnark"
     91     *  @since Jetty 7
     92     */
     93    public I2PSnarkUtil(I2PAppContext ctx, String baseName) {
    8594        _context = ctx;
    8695        _log = _context.logManager().getLog(Snark.class);
     96        _baseName = baseName;
    8797        _opts = new HashMap();
    8898        //setProxy("127.0.0.1", 4444);
     
    100110        // so it must be available even if not connected to I2CP.
    101111        // so much for multiple instances
    102         _tmpDir = new SecureDirectory(ctx.getTempDir(), "i2psnark");
     112        _tmpDir = new SecureDirectory(ctx.getTempDir(), baseName);
    103113        FileUtil.rmdir(_tmpDir, false);
    104114        _tmpDir.mkdirs();
     
    254264        }
    255265        if (_shouldUseDHT && _manager != null && _dht == null)
    256             _dht = new KRPC(_context, _manager.getSession());
     266            _dht = new KRPC(_context, _baseName, _manager.getSession());
    257267        return (_manager != null);
    258268    }
     
    589599        _shouldUseDHT = yes;
    590600        if (yes && _manager != null && _dht == null) {
    591             _dht = new KRPC(_context, _manager.getSession());
     601            _dht = new KRPC(_context, _baseName, _manager.getSession());
    592602        } else if (!yes && _dht != null) {
    593603            _dht.stop();
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r8857fe5 r56eba28a  
    5858    private Properties _config;
    5959    private final I2PAppContext _context;
     60    private final String _contextPath;
     61    private final String _contextName;
    6062    private final Log _log;
    6163    private final Queue<String> _messages;
     
    8385    public static final String PROP_META_MAGNET_PREFIX = "i2psnark.magnet.";
    8486
    85     private static final String CONFIG_FILE = "i2psnark.config";
     87    private static final String CONFIG_FILE_SUFFIX = ".config";
    8688    public static final String PROP_FILES_PUBLIC = "i2psnark.filesPublic";
    8789    public static final String PROP_AUTO_START = "i2snark.autoStart";   // oops
     
    129131    public static final String PROP_TRACKERS = "i2psnark.trackers";
    130132
    131     public SnarkManager(I2PAppContext ctx) {
     133    /**
     134     *  @param ctxPath generally "/i2psnark"
     135     *  @param ctxName generally "i2psnark"
     136     */
     137    public SnarkManager(I2PAppContext ctx, String ctxPath, String ctxName) {
    132138        _snarks = new ConcurrentHashMap();
    133139        _magnets = new ConcurrentHashSet();
    134140        _addSnarkLock = new Object();
    135141        _context = ctx;
     142        _contextPath = ctxPath;
     143        _contextName = ctxName;
    136144        _log = _context.logManager().getLog(SnarkManager.class);
    137145        _messages = new LinkedBlockingQueue();
    138         _util = new I2PSnarkUtil(_context);
    139         _configFile = new File(CONFIG_FILE);
     146        _util = new I2PSnarkUtil(_context, ctxName);
     147        String cfile = ctxName + CONFIG_FILE_SUFFIX;
     148        _configFile = new File(cfile);
    140149        if (!_configFile.isAbsolute())
    141             _configFile = new File(_context.getConfigDir(), CONFIG_FILE);
     150            _configFile = new File(_context.getConfigDir(), cfile);
    142151        _trackerMap = new ConcurrentHashMap(4);
    143152        loadConfig(null);
     
    260269
    261270    public File getDataDir() {
    262         String dir = _config.getProperty(PROP_DIR, "i2psnark");
     271        String dir = _config.getProperty(PROP_DIR, _contextName);
    263272        File f;
    264273        if (areFilesPublic())
     
    306315            _config.setProperty(PROP_UPLOADERS_TOTAL, "" + Snark.MAX_TOTAL_UPLOADERS);
    307316        if (!_config.containsKey(PROP_DIR))
    308             _config.setProperty(PROP_DIR, "i2psnark");
     317            _config.setProperty(PROP_DIR, _contextName);
    309318        if (!_config.containsKey(PROP_AUTO_START))
    310319            _config.setProperty(PROP_AUTO_START, DEFAULT_AUTO_START);
     
    732741    public Properties getConfig() { return _config; }
    733742   
     743    /** @since Jetty 7 */
     744    public String getConfigFilename() {
     745        return _configFile.getAbsolutePath();
     746    }
     747
    734748    /** hardcoded for sanity.  perhaps this should be customizable, for people who increase their ulimit, etc. */
    735749    public static final int MAX_FILES_PER_TORRENT = 512;
     
    14461460            return;
    14471461        StringBuilder buf = new StringBuilder(256);
    1448         buf.append("<a href=\"/i2psnark/").append(storage.getBaseName());
     1462        buf.append("<a href=\"").append(_contextPath).append('/').append(storage.getBaseName());
    14491463        if (meta.getFiles() != null)
    14501464            buf.append('/');
  • apps/i2psnark/java/src/org/klomp/snark/dht/KRPC.java

    r8857fe5 r56eba28a  
    153153    private static final long EXPLORE_TIME = 877*1000;
    154154    private static final long BLACKLIST_CLEAN_TIME = 17*60*1000;
    155     private static final String DHT_FILE = "i2psnark.dht.dat";
     155    private static final String DHT_FILE_SUFFIX = ".dht.dat";
    156156
    157157    private static final int SEND_CRYPTO_TAGS = 8;
    158158    private static final int LOW_CRYPTO_TAGS = 4;
    159159
    160     public KRPC (I2PAppContext ctx, I2PSession session) {
     160    /**
     161     *  @param baseName generally "i2psnark"
     162     */
     163    public KRPC (I2PAppContext ctx, String baseName, I2PSession session) {
    161164        _context = ctx;
    162165        _session = session;
     
    183186        }
    184187        _myNodeInfo = new NodeInfo(_myNID, session.getMyDestination(), _qPort);
    185         _dhtFile = new File(ctx.getConfigDir(), DHT_FILE);
     188        _dhtFile = new File(ctx.getConfigDir(), baseName + DHT_FILE_SUFFIX);
    186189        _knownNodes = new DHTNodes(ctx, _myNID);
    187190
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r8857fe5 r56eba28a  
    2525import javax.servlet.ServletConfig;
    2626import javax.servlet.ServletException;
     27import javax.servlet.http.HttpServlet;
    2728import javax.servlet.http.HttpServletRequest;
    2829import javax.servlet.http.HttpServletResponse;
     
    4546import org.klomp.snark.dht.DHT;
    4647
    47 import org.mortbay.jetty.servlet.DefaultServlet;
    48 import org.mortbay.resource.Resource;
    49 import org.mortbay.util.URIUtil;
    50 
    5148/**
    52  *  We extend Default instead of HTTPServlet so we can handle
    53  *  i2psnark/ file requests with http:// instead of the flaky and
    54  *  often-blocked-by-the-browser file://
     49 *  Refactored to eliminate Jetty dependencies.
    5550 */
    56 public class I2PSnarkServlet extends DefaultServlet {
    57     private I2PAppContext _context;
    58     private Log _log;
     51public class I2PSnarkServlet extends BasicServlet {
     52    /** generally "/i2psnark" */
     53    private String _contextPath;
     54    /** generally "i2psnark" */
     55    private String _contextName;
    5956    private SnarkManager _manager;
    6057    private static long _nonce;
    61     private Resource _resourceBase;
    6258    private String _themePath;
    6359    private String _imgPath;
    6460    private String _lastAnnounceURL;
    6561   
     62    private static final String DEFAULT_NAME = "i2psnark";
    6663    public static final String PROP_CONFIG_FILE = "i2psnark.configFile";
    6764 
     65    public I2PSnarkServlet() {
     66        super();
     67    }
     68
    6869    @Override
    6970    public void init(ServletConfig cfg) throws ServletException {
    70         _context = I2PAppContext.getGlobalContext();
    71         _log = _context.logManager().getLog(I2PSnarkServlet.class);
     71        super.init(cfg);
     72        String cpath = getServletContext().getContextPath();
     73        _contextPath = cpath == "" ? "/" : cpath;
     74        _contextName = cpath == "" ? DEFAULT_NAME : cpath.substring(1).replace("/", "_");
    7275        _nonce = _context.random().nextLong();
    73         _manager = new SnarkManager(_context);
     76        // limited protection against overwriting other config files or directories
     77        // in case you named your war "router.war"
     78        String configName = _contextName;
     79        if (!configName.equals(DEFAULT_NAME))
     80            configName = DEFAULT_NAME + '_' + _contextName;
     81        _manager = new SnarkManager(_context, _contextPath, configName);
    7482        String configFile = _context.getProperty(PROP_CONFIG_FILE);
    7583        if ( (configFile == null) || (configFile.trim().length() <= 0) )
    76             configFile = "i2psnark.config";
     84            configFile = configName + ".config";
    7785        _manager.loadConfig(configFile);
    7886        _manager.start();
    79         try {
    80             _resourceBase = Resource.newResource(_manager.getDataDir().getAbsolutePath());
    81         } catch (IOException ioe) {}
    82         super.init(cfg);
     87        loadMimeMap("org/klomp/snark/web/mime");
     88        setResourceBase(_manager.getDataDir());
     89        setWarBase("/.icons/");
    8390    }
    8491   
     
    96103     */
    97104    @Override
    98     public Resource getResource(String pathInContext)
     105    public File getResource(String pathInContext)
    99106    {
    100107        if (pathInContext == null || pathInContext.equals("/") || pathInContext.equals("/index.jsp") ||
     
    102109            return super.getResource(pathInContext);
    103110        // files in the i2psnark/ directory
    104         try {
    105             return _resourceBase.addPath(pathInContext);
    106         } catch (IOException ioe) {
    107             throw new RuntimeException(ioe);
    108         }
     111        return new File(_resourceBase, pathInContext);
    109112    }
    110113
    111114    /**
    112      *  Tell the browser to cache the icons
     115     *  Handle what we can here, calling super.doGet() for the rest.
    113116     *  @since 0.8.3
    114117     */
    115118    @Override
    116119    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    117         super.doGet(request, response);
     120        doGetAndPost(request, response);
    118121    }
    119122
    120123    /**
     124     *  Handle what we can here, calling super.doPost() for the rest.
     125     *  @since Jetty 7
     126     */
     127    @Override
     128    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     129        doGetAndPost(request, response);
     130    }
     131
     132    /**
     133     * Handle what we can here, calling super.doGet() or super.doPost() for the rest.
     134     *
    121135     * Some parts modified from:
    122136     * <pre>
     
    138152     *
    139153     */
    140     @Override
    141     public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     154    private void doGetAndPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
     155        if (_log.shouldLog(Log.DEBUG))
     156            _log.debug("Service " + req.getMethod() + " \"" + req.getContextPath() + "\" \"" + req.getServletPath() + "\" \"" + req.getPathInfo() + '"');
    142157        // since we are not overriding handle*(), do this here
    143158        String method = req.getMethod();
    144         if (!(method.equals("GET") || method.equals("HEAD") || method.equals("POST"))) {
    145             resp.sendError(405);
    146             return;
    147         }
    148159        _themePath = "/themes/snark/" + _manager.getTheme() + '/';
    149160        _imgPath = _themePath + "images/";
     
    177188        if (!(path == null || path.equals("/") || path.equals("/index.jsp") || path.equals("/index.html") || path.equals("/_post") || isConfigure)) {
    178189            if (path.endsWith("/")) {
     190                // Listing of a torrent (torrent detail page)
    179191                // bypass the horrid Resource.getListHTML()
    180192                String pathInfo = req.getPathInfo();
    181                 String pathInContext = URIUtil.addPaths(path, pathInfo);
     193                String pathInContext = addPaths(path, pathInfo);
    182194                req.setCharacterEncoding("UTF-8");
    183195                resp.setCharacterEncoding("UTF-8");
    184196                resp.setContentType("text/html; charset=UTF-8");
    185                 Resource resource = getResource(pathInContext);
    186                 if (resource == null || (!resource.exists())) {
     197                File resource = getResource(pathInContext);
     198                if (resource == null) {
    187199                    resp.sendError(404);
    188200                } else {
    189                     String base = URIUtil.addPaths(req.getRequestURI(), "/");
     201                    String base = addPaths(req.getRequestURI(), "/");
    190202                    String listing = getListHTML(resource, base, true, method.equals("POST") ? req.getParameterMap() : null);
    191203                    if (method.equals("POST")) {
     
    199211                }
    200212            } else {
    201                 super.service(req, resp);
     213                // local completed files in torrent directories
     214                if (method.equals("GET") || method.equals("HEAD"))
     215                    super.doGet(req, resp);
     216                else if (method.equals("POST"))
     217                    super.doPost(req, resp);
     218                else
     219                    resp.sendError(405);
    202220            }
    203221            return;
    204222        }
     223
     224        // Either the main page or /configure
    205225
    206226        req.setCharacterEncoding("UTF-8");
     
    237257                          "<script type=\"text/javascript\">\n"  +
    238258                          "var failMessage = \"<div class=\\\"routerdown\\\"><b>" + _("Router is down") + "<\\/b><\\/div>\";\n" +
    239                           "function requestAjax1() { ajax(\"/i2psnark/.ajax/xhr1.html" + peerString + "\", \"mainsection\", " + (delay*1000) + "); }\n" +
     259                          "function requestAjax1() { ajax(\"" + _contextPath + "/.ajax/xhr1.html" + peerString + "\", \"mainsection\", " + (delay*1000) + "); }\n" +
    240260                          "function initAjax() { setTimeout(requestAjax1, " + (delay*1000) +");  }\n"  +
    241261                          "</script>\n");
     
    250270        List<Tracker> sortedTrackers = null;
    251271        if (isConfigure) {
    252             out.write("<div class=\"snarknavbar\"><a href=\"/i2psnark/\" title=\"");
     272            out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + "/\" title=\"");
    253273            out.write(_("Torrents"));
    254274            out.write("\" class=\"snarkRefresh\">");
    255275            out.write("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "arrow_refresh.png\">&nbsp;&nbsp;");
    256             out.write(_("I2PSnark"));
     276            if (_contextName.equals(DEFAULT_NAME))
     277                out.write(_("I2PSnark"));
     278            else
     279                out.write(_contextName);
    257280            out.write("</a>");
    258281        } else {
    259             out.write("<div class=\"snarknavbar\"><a href=\"/i2psnark/" + peerString + "\" title=\"");
     282            out.write("<div class=\"snarknavbar\"><a href=\"" + _contextPath + '/' + peerString + "\" title=\"");
    260283            out.write(_("Refresh page"));
    261284            out.write("\" class=\"snarkRefresh\">");
    262285            out.write("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "arrow_refresh.png\">&nbsp;&nbsp;");
    263             out.write(_("I2PSnark"));
     286            if (_contextName.equals(DEFAULT_NAME))
     287                out.write(_("I2PSnark"));
     288            else
     289                out.write(_contextName);
    264290            out.write("</a> <a href=\"http://forum.i2p/viewforum.php?f=21\" class=\"snarkRefresh\" target=\"_blank\">");
    265291            out.write(_("Forum"));
     
    303329        if (!msgs.isEmpty()) {
    304330            out.write("<div class=\"snarkMessages\">");
    305             out.write("<a href=\"/i2psnark/");
     331            out.write("<a href=\"" + _contextPath + '/');
    306332            if (isConfigure)
    307333                out.write("configure");
     
    343369        out.write("\"></th>\n<th>");
    344370        if (_manager.util().connected() && !snarks.isEmpty()) {
    345             out.write(" <a href=\"/i2psnark/");
     371            out.write(" <a href=\"" + _contextPath + '/');
    346372            if (peerParam != null) {
    347373                out.write("\">");
     
    424450        } else if (_manager.util().connected()) {
    425451            if (isDegraded)
    426                 out.write("<a href=\"/i2psnark/?action=StopAll&amp;nonce=" + _nonce + "\"><img title=\"");
     452                out.write("<a href=\"" + _contextPath + "/?action=StopAll&amp;nonce=" + _nonce + "\"><img title=\"");
    427453            else {
    428454                // http://www.onenaught.com/posts/382/firefox-4-change-input-type-image-only-submits-x-and-y-not-name
     
    438464        } else if ((!_manager.util().isConnecting()) && !snarks.isEmpty()) {
    439465            if (isDegraded)
    440                 out.write("<a href=\"/i2psnark/?action=StartAll&amp;nonce=" + _nonce + "\"><img title=\"");
     466                out.write("<a href=\"/" + _contextPath + "/?action=StartAll&amp;nonce=" + _nonce + "\"><img title=\"");
    441467            else
    442468                out.write("<input type=\"image\" name=\"action_StartAll\" value=\"foo\" title=\"");
     
    451477        }
    452478        out.write("</th></tr></thead>\n");
    453         String uri = "/i2psnark/";
     479        String uri = _contextPath + '/';
    454480        boolean showDebug = "2".equals(peerParam);
    455481        for (int i = 0; i < snarks.size(); i++) {
     
    12461272            // Stop Button
    12471273            if (isDegraded)
    1248                 out.write("<a href=\"/i2psnark/?action=Stop_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
     1274                out.write("<a href=\"" + _contextPath + "/?action=Stop_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
    12491275            else
    12501276                out.write("<input type=\"image\" name=\"action_Stop_" + b64 + "\" value=\"foo\" title=\"");
     
    12601286                // This works in Opera but it's displayed a little differently, so use noThinsp here too so all 3 icons are consistent
    12611287                if (noThinsp)
    1262                     out.write("<a href=\"/i2psnark/?action=Start_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
     1288                    out.write("<a href=\"/" + _contextPath + "/?action=Start_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
    12631289                else
    12641290                    out.write("<input type=\"image\" name=\"action_Start_" + b64 + "\" value=\"foo\" title=\"");
     
    12741300                // Doesnt work with Opera so use noThinsp instead of isDegraded
    12751301                if (noThinsp)
    1276                     out.write("<a href=\"/i2psnark/?action=Remove_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
     1302                    out.write("<a href=\"" + _contextPath + "/?action=Remove_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
    12771303                else
    12781304                    out.write("<input type=\"image\" name=\"action_Remove_" + b64 + "\" value=\"foo\" title=\"");
     
    12941320            // Doesnt work with Opera so use noThinsp instead of isDegraded
    12951321            if (noThinsp)
    1296                 out.write("<a href=\"/i2psnark/?action=Delete_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
     1322                out.write("<a href=\"" + _contextPath + "/?action=Delete_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
    12971323            else
    12981324                out.write("<input type=\"image\" name=\"action_Delete_" + b64 + "\" value=\"foo\" title=\"");
     
    16211647        //int seedPct = 0;
    16221648       
    1623         out.write("<form action=\"/i2psnark/configure\" method=\"POST\">\n" +
     1649        out.write("<form action=\"" + _contextPath + "/configure\" method=\"POST\">\n" +
    16241650                  "<div class=\"configsectionpanel\"><div class=\"snarkConfig\">\n" +
    16251651                  "<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" >\n" +
     
    16331659        out.write(_("Data directory"));
    16341660        out.write(": <td><code>" + dataDir + "</code> <i>(");
    1635         out.write(_("Edit i2psnark.config and restart to change"));
     1661        // translators: parameter is a file name
     1662        out.write(_("Edit {0} and restart to change", _manager.getConfigFilename()));
    16361663        out.write(")</i><br>\n" +
    16371664
     
    18031830    private void writeTrackerForm(PrintWriter out, HttpServletRequest req) throws IOException {
    18041831        StringBuilder buf = new StringBuilder(1024);
    1805         buf.append("<form action=\"/i2psnark/configure\" method=\"POST\">\n" +
     1832        buf.append("<form action=\"" + _contextPath + "/configure\" method=\"POST\">\n" +
    18061833                  "<div class=\"configsectionpanel\"><div class=\"snarkConfig\">\n" +
    18071834                  "<input type=\"hidden\" name=\"nonce\" value=\"" + _nonce + "\" >\n" +
     
    20322059     * @since 0.7.14
    20332060     */
    2034     private String getListHTML(Resource r, String base, boolean parent, Map postParams)
     2061    private String getListHTML(File r, String base, boolean parent, Map postParams)
    20352062        throws IOException
    20362063    {
     
    20412068        }  // if r is not a directory, we are only showing torrent info section
    20422069       
    2043         String title = URIUtil.decodePath(base);
    2044         if (title.startsWith("/i2psnark/"))
    2045             title = title.substring("/i2psnark/".length());
     2070        String title = decodePath(base);
     2071        String cpath = _contextPath + '/';
     2072        if (title.startsWith(cpath))
     2073            title = title.substring(cpath.length());
    20462074
    20472075        // Get the snark associated with this directory
     
    20682096        buf.append(title);
    20692097        buf.append("</TITLE>").append(HEADER_A).append(_themePath).append(HEADER_B).append("<link rel=\"shortcut icon\" href=\"" + _themePath + "favicon.ico\">" +
    2070              "</HEAD><BODY>\n<center><div class=\"snarknavbar\"><a href=\"/i2psnark/\" title=\"Torrents\"");
    2071         buf.append(" class=\"snarkRefresh\"><img alt=\"\" border=\"0\" src=\"" + _imgPath + "arrow_refresh.png\">&nbsp;&nbsp;I2PSnark</a></div></center>\n");
     2098             "</HEAD><BODY>\n<center><div class=\"snarknavbar\"><a href=\"").append(_contextPath).append("/\" title=\"Torrents\"");
     2099        buf.append(" class=\"snarkRefresh\"><img alt=\"\" border=\"0\" src=\"" + _imgPath + "arrow_refresh.png\">&nbsp;&nbsp;");
     2100        if (_contextName.equals(DEFAULT_NAME))
     2101            buf.append(_("I2PSnark"));
     2102        else
     2103            buf.append(_contextName);
     2104        buf.append("</a></div></center>\n");
    20722105       
    20732106        if (parent)  // always true
     
    20902123               .append("<img alt=\"\" border=\"0\" src=\"" + _imgPath + "file.png\" >&nbsp;<b>")
    20912124               .append(_("Torrent file"))
    2092                .append(":</b> <a href=\"/i2psnark/").append(baseName).append("\">")
     2125               .append(":</b> <a href=\"").append(_contextPath).append('/').append(baseName).append("\">")
    20932126               .append(fullPath)
    20942127               .append("</a></td></tr>\n");
     
    22292262        buf.append("</tr>\n</thead>\n");
    22302263        buf.append("<tr><td colspan=\"" + (showPriority ? '5' : '4') + "\" class=\"ParentDir\"><A HREF=\"");
    2231         buf.append(URIUtil.addPaths(base,"../"));
     2264        buf.append(addPaths(base,"../"));
    22322265        buf.append("\"><img alt=\"\" border=\"0\" src=\"" + _imgPath + "up.png\"> ")
    22332266           .append(_("Up to higher level directory"))
     
    22402273        for (int i=0 ; i< ls.length ; i++)
    22412274        {   
    2242             String encoded=URIUtil.encodePath(ls[i]);
     2275            String encoded = encodePath(ls[i]);
    22432276            // bugfix for I2P - Backport from Jetty 6 (zero file lengths and last-modified times)
    22442277            // http://jira.codehaus.org/browse/JETTY-361?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel#issue-tabs
    22452278            // See resource.diff attachment
    22462279            //Resource item = addPath(encoded);
    2247             Resource item = r.addPath(ls[i]);
     2280            File item = new File(r, ls[i]);
    22482281           
    22492282            String rowClass = (i % 2 == 0 ? "snarkTorrentEven" : "snarkTorrentOdd");
     
    22652298                    Storage storage = snark.getStorage();
    22662299                    try {
    2267                         File f = item.getFile();
     2300                        File f = item;
    22682301                        if (f != null) {
    22692302                            long remaining = storage.remaining(f.getCanonicalPath());
     
    22952328            }
    22962329
    2297             String path=URIUtil.addPaths(base,encoded);
     2330            String path=addPaths(base,encoded);
    22982331            if (item.isDirectory() && !path.endsWith("/"))
    2299                 path=URIUtil.addPaths(path,"/");
     2332                path=addPaths(path,"/");
    23002333            String icon = toIcon(item);
    23012334
     
    23322365            if (showPriority) {
    23332366                buf.append("<td class=\"priority\">");
    2334                 File f = item.getFile();
     2367                File f = item;
    23352368                if ((!complete) && (!item.isDirectory()) && f != null) {
    23362369                    int pri = snark.getStorage().getPriority(f.getCanonicalPath());
     
    23692402
    23702403    /** @since 0.7.14 */
    2371     private String toIcon(Resource item) {
     2404    private String toIcon(File item) {
    23722405        if (item.isDirectory())
    23732406            return "folder";
     
    23822415    private String toIcon(String path) {
    23832416        String icon;
    2384         // Should really just add to the mime.properties file in org.mortbay.jetty.jar
    2385         // instead of this mishmash. We can't get to HttpContext.setMimeMapping()
    2386         // from here? We could do it from a web.xml perhaps.
    2387         // Or could we put our own org/mortbay/http/mime.properties file in the war?
     2417        // Note that for this to work well, our custom mime.properties file must be loaded.
    23882418        String plc = path.toLowerCase(Locale.US);
    2389         String mime = getServletContext().getMimeType(path);
     2419        String mime = getMimeType(path);
    23902420        if (mime == null)
    23912421            mime = "";
    23922422        if (mime.equals("text/html"))
    23932423            icon = "html";
    2394         else if (mime.equals("text/plain") || plc.endsWith(".nfo") ||
     2424        else if (mime.equals("text/plain") ||
    23952425                 mime.equals("application/rtf"))
    23962426            icon = "page";
    2397         else if (mime.equals("application/java-archive") || plc.endsWith(".war") ||
     2427        else if (mime.equals("application/java-archive") ||
    23982428                 plc.endsWith(".deb"))
    23992429            icon = "package";
     
    24022432        else if (mime.equals("application/pdf"))
    24032433            icon = "page_white_acrobat";
    2404         else if (mime.startsWith("image/") || plc.endsWith(".ico"))
     2434        else if (mime.startsWith("image/"))
    24052435            icon = "photo";
    2406         else if (mime.startsWith("audio/") || mime.equals("application/ogg") ||
    2407                  plc.endsWith(".flac") || plc.endsWith(".m4a") || plc.endsWith(".wma") ||
    2408                  plc.endsWith(".ape") || plc.endsWith(".oga"))
     2436        else if (mime.startsWith("audio/") || mime.equals("application/ogg"))
    24092437            icon = "music";
    2410         else if (mime.startsWith("video/") || plc.endsWith(".mkv") || plc.endsWith(".m4v") ||
    2411                  plc.endsWith(".mp4") || plc.endsWith(".wmv") || plc.endsWith(".flv") ||
    2412                  plc.endsWith(".ogm") || plc.endsWith(".ogv"))
     2438        else if (mime.startsWith("video/"))
    24132439            icon = "film";
    24142440        else if (mime.equals("application/zip") || mime.equals("application/x-gtar") ||
    24152441                 mime.equals("application/compress") || mime.equals("application/gzip") ||
    2416                  mime.equals("application/x-tar") ||
    2417                  plc.endsWith(".rar") || plc.endsWith(".bz2") || plc.endsWith(".7z"))
     2442                 mime.equals("application/x-tar"))
    24182443            icon = "compress";
    24192444        else if (plc.endsWith(".exe"))
     
    24272452   
    24282453    /** @since 0.7.14 */
    2429     private static String toImg(String icon) {
    2430         return "<img alt=\"\" height=\"16\" width=\"16\" src=\"/i2psnark/.icons/" + icon + ".png\">";
     2454    private String toImg(String icon) {
     2455        return "<img alt=\"\" height=\"16\" width=\"16\" src=\"" + _contextPath + "/.icons/" + icon + ".png\">";
    24312456    }
    24322457
    24332458    /** @since 0.8.2 */
    2434     private static String toImg(String icon, String altText) {
    2435         return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"/i2psnark/.icons/" + icon + ".png\">";
     2459    private String toImg(String icon, String altText) {
     2460        return "<img alt=\"" + altText + "\" height=\"16\" width=\"16\" src=\"" + _contextPath + "/.icons/" + icon + ".png\">";
    24362461    }
    24372462
  • apps/i2psnark/java/src/org/klomp/snark/web/RunStandalone.java

    r8857fe5 r56eba28a  
    66import net.i2p.util.FileUtil;
    77
    8 import org.mortbay.jetty.Server;
     8import org.eclipse.jetty.server.Server;
    99
    1010public class RunStandalone {
  • apps/jetty/build.xml

    r8857fe5 r56eba28a  
    22<project basedir="." default="all" name="jetty">
    33
    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" />
     4    <property name="jetty.ver" value="7.6.8.v20121106" />
     5    <property name="jetty.base" value="jetty-distribution-${jetty.ver}" />
     6    <property name="jetty.sha1" value="6fcdc3f532c5ab72843e12cbac3d7cb797cdb5b9" />
    77    <property name="jetty.filename" value="${jetty.base}.zip" />
    8     <property name="jetty.url" value="http://dist.codehaus.org/jetty/${jetty.base}/${jetty.filename}" />
     8    <property name="jetty.url" value="http://download.eclipse.org/jetty/${jetty.ver}/dist/${jetty.filename}" />
    99    <property name="verified.filename" value="verified.txt" />
    1010    <property name="javac.compilerargs" value="" />
     
    9090              start.jar: Needed for clients.config startup of eepsites
    9191              jetty-util-xxx.jar: LifeCycle (base class for stuff), URIUtil (used in i2psnark)
    92               jetty-sslengine-xxx.jar: SSL NIO Connector for console
    93               jetty-java5-threadpool-xxx.jar: Concurrent thread pool for eepsite
     92              jetty-deploy, -http, -io, -security, -servlet, -webapp: All split out from main server jar in Jetty 7
     93              jetty-continuation-xxx.jar: Needed? Useful?
     94              jetty-servlets-xxx.jar: Needed for CGI for eepsite
     95              jetty-sslengine-xxx.jar: Old Jetty 6, now a dummy
     96              jetty-java5-threadpool-xxx.jar: Old Jetty 6, now a dummy
    9497              glassfish 2.1: Not used, too old, see Tomcat below.
    9598              jetty-rewrite-handler: Not used by I2P, but only 20KB and could be useful for eepsites
     
    98101        -->
    99102        <copy preservelastmodified="true" file="${jetty.base}/start.jar" tofile="jettylib/jetty-start.jar" />
    100         <copy file="${jetty.base}/lib/${jetty.base}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
     103        <copy file="${jetty.base}/lib/jetty-server-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jetty.jar" />
     104        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-continuation-${jetty.ver}.jar" tofile="jettylib/jetty-continuation.jar" />
     105        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-deploy-${jetty.ver}.jar" tofile="jettylib/jetty-deploy.jar" />
     106        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-http-${jetty.ver}.jar" tofile="jettylib/jetty-http.jar" />
     107        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-io-${jetty.ver}.jar" tofile="jettylib/jetty-io.jar" />
     108        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-jmx-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jmx.jar" />
     109        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-rewrite-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" />
     110        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-security-${jetty.ver}.jar" tofile="jettylib/jetty-security.jar" />
     111        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlet-${jetty.ver}.jar" tofile="jettylib/jetty-servlet.jar" />
     112        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-servlets-${jetty.ver}.jar" tofile="jettylib/jetty-servlets.jar" />
    101113        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-util-${jetty.ver}.jar" tofile="jettylib/jetty-util.jar" />
    102         <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-java5-threadpool-${jetty.ver}.jar" tofile="jettylib/jetty-java5-threadpool.jar" />
    103         <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-rewrite-handler-${jetty.ver}.jar" tofile="jettylib/jetty-rewrite-handler.jar" />
    104         <copy preservelastmodified="true" file="${jetty.base}/lib/ext/jetty-sslengine-${jetty.ver}.jar" tofile="jettylib/jetty-sslengine.jar" />
    105         <copy preservelastmodified="true" file="${jetty.base}/lib/management/jetty-management-${jetty.ver}.jar" tofile="jettylib/org.mortbay.jmx.jar" />
     114        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-webapp-${jetty.ver}.jar" tofile="jettylib/jetty-webapp.jar" />
     115        <copy preservelastmodified="true" file="${jetty.base}/lib/jetty-xml-${jetty.ver}.jar" tofile="jettylib/jetty-xml.jar" />
     116        <jar destfile="jettylib/jetty-java5-threadpool.jar" >
     117            <manifest>
     118                <attribute name="Note" value="Intentionally empty" />
     119            </manifest>
     120        </jar>
     121        <jar destfile="jettylib/jetty-sslengine.jar" >
     122            <manifest>
     123                <attribute name="Note" value="Intentionally empty" />
     124            </manifest>
     125        </jar>
    106126        <delete file="jetty.tar" />
    107127      <!--
     
    156176
    157177    <target name="builddep" />
     178
    158179    <target name="compile" depends="builddep, ensureJettylib" >
    159180        <mkdir dir="./build" />
     
    161182        <javac
    162183            srcdir="./java/src"
    163             debug="true" source="1.5" target="1.5"
     184            debug="true" deprecation="on" source="1.5" target="1.5"
    164185            destdir="./build/obj"
    165186            includeAntRuntime="false"
    166             classpath="../../core/java/build/i2p.jar:./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-util.jar" >
     187            classpath="../../core/java/build/i2p.jar:./jettylib/commons-logging.jar:./jettylib/javax.servlet.jar:./jettylib/org.mortbay.jetty.jar:./jettylib/jetty-http.jar:./jettylib/jetty-io.jar:./jettylib/jetty-util.jar:./jettylib/jetty-xml.jar" >
    167188            <compilerarg line="${javac.compilerargs}" />
    168189        </javac>
  • apps/jetty/java/src/net/i2p/jetty/I2PLogger.java

    r8857fe5 r56eba28a  
    1818import net.i2p.util.Log;
    1919
    20 import org.mortbay.jetty.Server;
    21 import org.mortbay.log.Logger;
     20import org.eclipse.jetty.server.Server;
     21import org.eclipse.jetty.util.log.Logger;
    2222
    2323/**
    2424 * Modified from Jetty 6.1.26 StdErrLog.java and Slf4jLog.java
    2525 *
    26  * Usage: org.mortbay.log.Log.setLog(new I2PLogger(ctx));
     26 * Usage: org.eclipse.log.Log.setLog(new I2PLogger(ctx));
    2727 *
    2828 * @since Jetty 6
     
    183183    }
    184184   
    185 
     185    /**
     186     *  @since Jetty 7
     187     */
     188    public void ignore(Throwable ignored)
     189    {
     190            warn("IGNORED", ignored);
     191    }
     192   
     193    /**
     194     *  @since Jetty 7
     195     */
     196    public void debug(Throwable thrown)
     197    {
     198            debug("", thrown);
     199    }
     200   
     201    /**
     202     *  @since Jetty 7
     203     */
     204    public void debug(String msg, Object... args)
     205    {
     206            Object a1 = args.length > 0 ? args[0] : null;
     207            Object a2 = args.length > 1 ? args[1] : null;
     208            debug(msg, a1, a2);
     209    }
     210   
     211    /**
     212     *  @since Jetty 7
     213     */
     214    public void info(Throwable thrown)
     215    {
     216            info("", thrown);
     217    }
     218   
     219    /**
     220     *  @since Jetty 7
     221     */
     222    public void info(String msg, Object... args)
     223    {
     224            Object a1 = args.length > 0 ? args[0] : null;
     225            Object a2 = args.length > 1 ? args[1] : null;
     226            info(msg, a1, a2);
     227    }
     228   
     229    /**
     230     *  @since Jetty 7
     231     */
     232    public void info(String msg, Throwable th)
     233    {
     234        _log.info(msg,th);
     235    }
     236
     237    /**
     238     *  @since Jetty 7
     239     */
     240    public void warn(Throwable thrown)
     241    {
     242            warn("", thrown);
     243    }
     244   
     245    /**
     246     *  @since Jetty 7
     247     */
     248    public void warn(String msg, Object... args)
     249    {
     250            Object a1 = args.length > 0 ? args[0] : null;
     251            Object a2 = args.length > 1 ? args[1] : null;
     252            warn(msg, a1, a2);
     253    }
     254
     255    /**
     256     *  @since Jetty 7
     257     */
     258    public String getName() {
     259        return "net.i2p.jetty.I2PLogger";
     260    }
    186261}
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    r8857fe5 r56eba28a  
    2525import javax.servlet.http.Cookie;
    2626
    27 import org.mortbay.component.AbstractLifeCycle;
    28 import org.mortbay.jetty.HttpHeaders;
    29 import org.mortbay.jetty.Request;
    30 import org.mortbay.jetty.RequestLog;
    31 import org.mortbay.jetty.Response;
    32 import org.mortbay.jetty.servlet.PathMap;
    33 import org.mortbay.log.Log;
    34 import org.mortbay.util.DateCache;
    35 import org.mortbay.util.RolloverFileOutputStream;
    36 import org.mortbay.util.StringUtil;
    37 import org.mortbay.util.TypeUtil;
    38 import org.mortbay.util.Utf8StringBuffer;
     27import org.eclipse.jetty.http.HttpHeaders;
     28import org.eclipse.jetty.http.PathMap;
     29import org.eclipse.jetty.server.Request;
     30import org.eclipse.jetty.server.RequestLog;
     31import org.eclipse.jetty.server.Response;
     32import org.eclipse.jetty.util.DateCache;
     33import org.eclipse.jetty.util.RolloverFileOutputStream;
     34import org.eclipse.jetty.util.StringUtil;
     35import org.eclipse.jetty.util.TypeUtil;
     36import org.eclipse.jetty.util.Utf8StringBuilder;
     37import org.eclipse.jetty.util.component.AbstractLifeCycle;
     38import org.eclipse.jetty.util.log.Log;
    3939
    4040/**
     
    5757 * So that we will work with system Jetty 6 packages, we just copy the whole thing
    5858 * and modify log() as required.
    59  * We leave the package as org.mortbay.http for compatibility with old
    60  * jetty.xml files.
    6159 *
    6260 * @author Greg Wilkins
     
    260258                return;
    261259
    262             Utf8StringBuffer u8buf;
    263             StringBuffer buf;
     260            Utf8StringBuilder u8buf;
     261            StringBuilder buf;
    264262            synchronized(_writer)
    265263            {
    266264                int size=_buffers.size();
    267                 u8buf = size==0?new Utf8StringBuffer(160):(Utf8StringBuffer)_buffers.remove(size-1);
    268                 buf = u8buf.getStringBuffer();
     265                u8buf = size==0?new Utf8StringBuilder(160):(Utf8StringBuilder)_buffers.remove(size-1);
     266                buf = u8buf.getStringBuilder();
    269267            }
    270268           
     
    399397                    {
    400398                        _writer.write(' ');
    401                         _writer.write(TypeUtil.toString(System.currentTimeMillis() - request.getTimeStamp()));
     399                        _writer.write(Long.toString(System.currentTimeMillis() - request.getTimeStamp()));
    402400                    }
    403401
  • apps/jetty/java/src/net/i2p/jetty/JettyStart.java

    r8857fe5 r56eba28a  
    2020import java.util.Arrays;
    2121import java.util.List;
     22import java.util.Map;
    2223import java.util.Properties;
    2324
     
    2627import static net.i2p.app.ClientAppState.*;
    2728
    28 import org.mortbay.component.LifeCycle;
    29 import org.mortbay.resource.Resource;
    30 import org.mortbay.xml.XmlConfiguration;
     29import org.eclipse.jetty.util.component.LifeCycle;
     30import org.eclipse.jetty.util.resource.Resource;
     31import org.eclipse.jetty.xml.XmlConfiguration;
    3132
    3233/**
     
    7475                if (last!=null)
    7576                    configuration.getIdMap().putAll(last.getIdMap());
    76                 if (properties.size()>0)
    77                     configuration.setProperties(properties);
     77                if (properties.size()>0) {
     78                    // to avoid compiler errror
     79                    Map foo = configuration.getProperties();
     80                    foo.putAll(properties);
     81                }
    7882                Object o = configuration.configure();
    7983                if (o instanceof LifeCycle)
  • apps/routerconsole/java/build.xml

    r8857fe5 r56eba28a  
    6464                <pathelement location="../../../router/java/build/router.jar" />
    6565                <pathelement location="../../jetty/jettylib/org.mortbay.jetty.jar" />
     66                <pathelement location="../../jetty/jettylib/jetty-http.jar" />
     67                <pathelement location="../../jetty/jettylib/jetty-io.jar" />
     68                <pathelement location="../../jetty/jettylib/jetty-security.jar" />
     69                <pathelement location="../../jetty/jettylib/jetty-servlet.jar" />
     70                <pathelement location="../../jetty/jettylib/jetty-servlets.jar" />
    6671                <pathelement location="../../jetty/jettylib/jetty-util.jar" />
    67                 <pathelement location="../../jetty/jettylib/jetty-sslengine.jar" />
    68                 <pathelement location="../../jetty/jettylib/jetty-java5-threadpool.jar" />
     72                <pathelement location="../../jetty/jettylib/jetty-webapp.jar" />
    6973                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
    7074                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java

    r8857fe5 r56eba28a  
    1818import static net.i2p.update.UpdateType.*;
    1919
    20 import org.mortbay.jetty.handler.ContextHandlerCollection;
     20import org.eclipse.jetty.server.handler.ContextHandlerCollection;
    2121
    2222/**
  • apps/routerconsole/java/src/net/i2p/router/web/ConsolePasswordManager.java

    r8857fe5 r56eba28a  
    1313import net.i2p.router.util.RouterPasswordManager;
    1414
    15 //import org.mortbay.jetty.security.UnixCrypt;
     15//import org.eclipse.jetty.util.security.UnixCrypt;
    1616
    1717/**
  • apps/routerconsole/java/src/net/i2p/router/web/LocaleWebAppHandler.java

    r8857fe5 r56eba28a  
    11package net.i2p.router.web;
    22
     3import java.io.File;
    34import java.io.IOException;
    45import java.util.Locale;
     
    1112import net.i2p.I2PAppContext;
    1213
    13 import org.mortbay.jetty.webapp.WebAppContext;
     14import org.eclipse.jetty.server.Request;
     15import org.eclipse.jetty.server.handler.HandlerWrapper;
     16import org.eclipse.jetty.server.session.SessionHandler;
     17import org.eclipse.jetty.servlet.ServletHandler;
     18import org.eclipse.jetty.webapp.WebAppContext;
    1419
    1520/**
     
    2227 * @author zzz
    2328 */
    24 public class LocaleWebAppHandler extends WebAppContext
     29public class LocaleWebAppHandler extends HandlerWrapper
    2530{
    2631    private final I2PAppContext _context;
     32    private final WebAppContext _wac;
    2733
    28     public LocaleWebAppHandler(I2PAppContext ctx, String path, String warPath) {
    29         super(warPath, path);
     34    public LocaleWebAppHandler(I2PAppContext ctx, String path, String warPath,
     35                               File tmpdir, ServletHandler servletHandler) {
     36        super();
    3037        _context = ctx;
     38        _wac = new WebAppContext(warPath, path);
    3139        setInitParams(WebAppStarter.INIT_PARAMS);
     40        _wac.setTempDirectory(tmpdir);
     41        _wac.setExtractWAR(false);
     42        _wac.setSessionHandler(new SessionHandler());
     43        _wac.setServletHandler(servletHandler);
     44        setHandler(_wac);
    3245    }
    3346   
     
    3851     *  Unless language == "en".
    3952     */
    40     @Override
    4153    public void handle(String pathInContext,
     54                       Request baseRequest,
    4255                       HttpServletRequest httpRequest,
    43                        HttpServletResponse httpResponse,
    44                        int dispatch)
     56                       HttpServletResponse httpResponse)
    4557         throws IOException, ServletException
    4658    {
    47         // Handle OPTIONS (nothing to override)
    48         if ("OPTIONS".equals(httpRequest.getMethod()))
    49         {
    50             handleOptions(httpRequest, httpResponse);
    51             return;
    52         }
    5359
    5460        // transparent rewriting
     
    7884                    String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
    7985                    // Do we have a servlet for the new path that isn't the catchall *.jsp?
    80                     Map.Entry servlet = getServletHandler().getHolderEntry(testPath);
     86                    Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
    8187                    if (servlet != null) {
    8288                        String servletPath = (String) servlet.getKey();
     
    9197        }
    9298        //System.err.println("New path: " + newPath);
    93         super.handle(newPath, httpRequest, httpResponse, dispatch);
     99        super.handle(newPath, baseRequest, httpRequest, httpResponse);
    94100        //System.err.println("Was handled? " + httpRequest.isHandled());
    95101    }
     
    113119     *  @since 0.8
    114120     */
     121/****  not in Jetty 7
    115122    public void handleOptions(HttpServletRequest request,
    116123                              HttpServletResponse response)
     
    119126        response.sendError(405);
    120127    }
     128****/
     129
     130    /**
     131     *  Mysteriously removed from Jetty 7
     132     */
     133    private void setInitParams(Map params) {
     134        setInitParams(_wac, params);
     135    }
     136
     137    /**
     138     *  @since Jetty 7
     139     */
     140    public static void setInitParams(WebAppContext context, Map<?,?> params) {
     141        for (Map.Entry e : params.entrySet()) {
     142            context.setInitParameter((String)e.getKey(), (String)e.getValue());
     143        }
     144    }
    121145}
  • apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java

    r8857fe5 r56eba28a  
    88import net.i2p.util.VersionComparator;
    99
    10 import org.mortbay.jetty.Server;
     10import org.eclipse.jetty.server.Server;
    1111import org.tanukisoftware.wrapper.WrapperManager;
    1212
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    r8857fe5 r56eba28a  
    3535import net.i2p.util.VersionComparator;
    3636
    37 import org.mortbay.jetty.handler.ContextHandlerCollection;
     37import org.eclipse.jetty.server.handler.ContextHandlerCollection;
    3838
    3939
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    r8857fe5 r56eba28a  
    4343import net.i2p.util.VersionComparator;
    4444
    45 import org.mortbay.jetty.AbstractConnector;
    46 import org.mortbay.jetty.Connector;
    47 import org.mortbay.jetty.NCSARequestLog;
    48 import org.mortbay.jetty.Server;
    49 import org.mortbay.jetty.bio.SocketConnector;
    50 import org.mortbay.jetty.handler.ContextHandlerCollection;
    51 import org.mortbay.jetty.handler.DefaultHandler;
    52 import org.mortbay.jetty.handler.HandlerCollection;
    53 import org.mortbay.jetty.handler.RequestLogHandler;
    54 import org.mortbay.jetty.nio.SelectChannelConnector;
    55 import org.mortbay.jetty.security.Credential.MD5;
    56 import org.mortbay.jetty.security.DigestAuthenticator;
    57 import org.mortbay.jetty.security.HashUserRealm;
    58 import org.mortbay.jetty.security.Constraint;
    59 import org.mortbay.jetty.security.ConstraintMapping;
    60 import org.mortbay.jetty.security.SecurityHandler;
    61 import org.mortbay.jetty.security.SslSocketConnector;
    62 import org.mortbay.jetty.security.SslSelectChannelConnector;
    63 import org.mortbay.jetty.servlet.ServletHandler;
    64 import org.mortbay.jetty.servlet.ServletHolder;
    65 import org.mortbay.jetty.servlet.SessionHandler;
    66 import org.mortbay.jetty.webapp.WebAppContext;
    67 import org.mortbay.thread.QueuedThreadPool;
    68 import org.mortbay.thread.concurrent.ThreadPool;
     45import org.eclipse.jetty.security.HashLoginService;
     46import org.eclipse.jetty.security.ConstraintMapping;
     47import org.eclipse.jetty.security.ConstraintSecurityHandler;
     48import org.eclipse.jetty.security.SecurityHandler;
     49import org.eclipse.jetty.security.authentication.DigestAuthenticator;
     50import org.eclipse.jetty.server.AbstractConnector;
     51import org.eclipse.jetty.server.Connector;
     52import org.eclipse.jetty.server.NCSARequestLog;
     53import org.eclipse.jetty.server.Server;
     54import org.eclipse.jetty.server.bio.SocketConnector;
     55import org.eclipse.jetty.server.handler.ContextHandlerCollection;
     56import org.eclipse.jetty.server.handler.DefaultHandler;
     57import org.eclipse.jetty.server.handler.HandlerCollection;
     58import org.eclipse.jetty.server.handler.HandlerWrapper;
     59import org.eclipse.jetty.server.handler.RequestLogHandler;
     60import org.eclipse.jetty.server.nio.SelectChannelConnector;
     61import org.eclipse.jetty.server.ssl.SslSocketConnector;
     62import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
     63import org.eclipse.jetty.servlet.ServletHandler;
     64import org.eclipse.jetty.servlet.ServletHolder;
     65import org.eclipse.jetty.webapp.WebAppContext;
     66import org.eclipse.jetty.util.security.Constraint;
     67import org.eclipse.jetty.util.security.Credential;
     68import org.eclipse.jetty.util.security.Credential.MD5;
     69import org.eclipse.jetty.util.thread.ExecutorThreadPool;
     70import org.eclipse.jetty.util.thread.QueuedThreadPool;
     71import org.eclipse.jetty.util.thread.ThreadPool;
    6972
    7073/**
     
    294297        //}
    295298        // This way it doesn't try to load Slf4jLog first
    296         System.setProperty("org.mortbay.log.class", "net.i2p.jetty.I2PLogger");
     299        System.setProperty("org.eclipse.jetty.util.log.class", "net.i2p.jetty.I2PLogger");
    297300
    298301        // so Jetty can find WebAppConfiguration
     
    303306        try {
    304307            ThreadPool ctp = new CustomThreadPoolExecutor();
    305             ctp.prestartAllCoreThreads();
     308            // Gone in Jetty 7
     309            //ctp.prestartAllCoreThreads();
    306310            _server.setThreadPool(ctp);
    307311        } catch (Throwable t) {
     
    316320        HandlerCollection hColl = new HandlerCollection();
    317321        ContextHandlerCollection chColl = new ContextHandlerCollection();
    318         _server.addHandler(hColl);
     322        // gone in Jetty 7
     323        //_server.addHandler(hColl);
     324        _server.setHandler(hColl);
    319325        hColl.addHandler(chColl);
    320326        hColl.addHandler(new DefaultHandler());
     
    352358            _webAppsDir += '/';
    353359
    354         WebAppContext rootWebApp = null;
     360        HandlerWrapper rootWebApp = null;
    355361        ServletHandler rootServletHandler = null;
    356362        List<Connector> connectors = new ArrayList(4);
     
    508514            }
    509515
    510             rootWebApp = new LocaleWebAppHandler(_context,
    511                                                   "/", _webAppsDir + ROUTERCONSOLE + ".war");
    512516            File tmpdir = new SecureDirectory(workDir, ROUTERCONSOLE + "-" +
    513517                                                       (_listenPort != null ? _listenPort : _sslListenPort));
    514518            tmpdir.mkdir();
    515             rootWebApp.setTempDirectory(tmpdir);
    516             rootWebApp.setExtractWAR(false);
    517             rootWebApp.setSessionHandler(new SessionHandler());
    518519            rootServletHandler = new ServletHandler();
    519             rootWebApp.setServletHandler(rootServletHandler);
    520             initialize(_context, rootWebApp);
     520            rootWebApp = new LocaleWebAppHandler(_context,
     521                                                  "/", _webAppsDir + ROUTERCONSOLE + ".war",
     522                                                 tmpdir, rootServletHandler);
     523            initialize(_context, (WebAppContext)(rootWebApp.getHandler()));
    521524            chColl.addHandler(rootWebApp);
    522525
     
    728731     */
    729732    static void initialize(RouterContext ctx, WebAppContext context) {
    730         SecurityHandler sec = new SecurityHandler();
     733        ConstraintSecurityHandler sec = new ConstraintSecurityHandler();
    731734        List<ConstraintMapping> constraints = new ArrayList(4);
    732735        ConsolePasswordManager mgr = new ConsolePasswordManager(ctx);
     
    738741                ctx.router().saveConfig(PROP_CONSOLE_PW, "false");
    739742            } else {
    740                 HashUserRealm realm = new HashUserRealm(JETTY_REALM);
    741                 sec.setUserRealm(realm);
     743                HashLoginService realm = new HashLoginService(JETTY_REALM);
     744                sec.setLoginService(realm);
    742745                sec.setAuthenticator(authenticator);
    743746                for (Map.Entry<String, String> e : userpw.entrySet()) {
    744747                    String user = e.getKey();
    745748                    String pw = e.getValue();
    746                     realm.put(user, MD5.__TYPE + pw);
    747                     realm.addUserToRole(user, JETTY_ROLE);
     749                    realm.putUser(user, Credential.getCredential(MD5.__TYPE + pw), new String[] {JETTY_ROLE});
    748750                    Constraint constraint = new Constraint(user, JETTY_ROLE);
    749751                    constraint.setAuthenticate(true);
     
    844846     * @since Jetty 6
    845847     */
    846     private static class CustomThreadPoolExecutor extends ThreadPool {
     848    private static class CustomThreadPoolExecutor extends ExecutorThreadPool {
    847849        public CustomThreadPoolExecutor() {
    848850             super(MIN_THREADS, MAX_THREADS, MAX_IDLE_TIME, TimeUnit.MILLISECONDS,
    849                    new SynchronousQueue(), new CustomThreadFactory(),
    850                    new ThreadPoolExecutor.CallerRunsPolicy());
     851                   new SynchronousQueue()  /** ,  following args not available in Jetty 7
     852                   new CustomThreadFactory(),
     853                   new ThreadPoolExecutor.CallerRunsPolicy() **/
     854                  );
    851855        }
    852856    }
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    r8857fe5 r56eba28a  
    1111import net.i2p.I2PAppContext;
    1212
    13 import org.mortbay.jetty.webapp.Configuration;
    14 import org.mortbay.jetty.webapp.WebAppClassLoader;
    15 import org.mortbay.jetty.webapp.WebAppContext;
     13import org.eclipse.jetty.webapp.Configuration;
     14import org.eclipse.jetty.webapp.WebAppClassLoader;
     15import org.eclipse.jetty.webapp.WebAppContext;
    1616
    1717
     
    3939 */
    4040public class WebAppConfiguration implements Configuration {
    41     private WebAppContext _wac;
    4241
    4342    private static final String CLASSPATH = ".classpath";
    4443
    45     public void setWebAppContext(WebAppContext context) {
    46        _wac = context;
    47     }
    48 
    49     public WebAppContext getWebAppContext() {
    50         return _wac;
    51     }
    52 
    5344    /**
    54      *  This was the interface in Jetty 5, now it's configureClassLoader()
     45     *  This was the interface in Jetty 5, in Jetty 6 was configureClassLoader(),
     46     *  now it's configure()
    5547     */
    56     private void configureClassPath() throws Exception {
    57         String ctxPath = _wac.getContextPath();
     48    private void configureClassPath(WebAppContext wac) throws Exception {
     49        String ctxPath = wac.getContextPath();
    5850        //System.err.println("Configure Class Path " + ctxPath);
    5951        if (ctxPath.equals("/"))
     
    111103        if (buf.length() <= 0)
    112104            return;
    113         ClassLoader cl = _wac.getClassLoader();
     105        ClassLoader cl = wac.getClassLoader();
    114106        if (cl != null && cl instanceof WebAppClassLoader) {
    115107            WebAppClassLoader wacl = (WebAppClassLoader) cl;
     
    119111            // and it calls getExtraClasspath in its constructor
    120112            // Not sure why WACL already exists...
    121             _wac.setExtraClasspath(buf.toString());
     113            wac.setExtraClasspath(buf.toString());
    122114        }
    123115    }
     
    134126    }
    135127
    136     public void configureDefaults() {}
    137     public void configureWebApp() {}
     128    /** @since Jetty 7 */
     129    public void deconfigure(WebAppContext context) {}
    138130
    139     /** @since Jetty 6 */
    140     public void deconfigureWebApp() {}
     131    /** @since Jetty 7 */
     132    public void configure(WebAppContext context) throws Exception {
     133        configureClassPath(context);
     134    }
    141135
    142     /** @since Jetty 6 */
    143     public void configureClassLoader() throws Exception {
    144         configureClassPath();
     136    /** @since Jetty 7 */
     137    public void cloneConfigure(WebAppContext template, WebAppContext context) {
     138        // no state, nothing to be done
    145139    }
     140
     141    /** @since Jetty 7 */
     142    public void destroy(WebAppContext context) {}
     143
     144    /** @since Jetty 7 */
     145    public void preConfigure(WebAppContext context) {}
     146
     147    /** @since Jetty 7 */
     148    public void postConfigure(WebAppContext context) {}
    146149}
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java

    r8857fe5 r56eba28a  
    1111import net.i2p.util.SecureDirectory;
    1212
    13 import org.mortbay.jetty.Handler;
    14 import org.mortbay.jetty.Server;
    15 import org.mortbay.jetty.webapp.WebAppContext;
    16 import org.mortbay.jetty.handler.ContextHandler;
    17 import org.mortbay.jetty.handler.ContextHandlerCollection;
     13import org.eclipse.jetty.server.Handler;
     14import org.eclipse.jetty.server.Server;
     15import org.eclipse.jetty.server.handler.ContextHandler;
     16import org.eclipse.jetty.server.handler.ContextHandlerCollection;
     17import org.eclipse.jetty.webapp.WebAppContext;
    1818
    1919
     
    5757         WebAppContext wac = addWebApp(ctx, server, appName, warPath, tmpdir);     
    5858         //_log.debug("Loading war from: " + warPath);
    59          wac.setInitParams(INIT_PARAMS);
     59         LocaleWebAppHandler.setInitParams(wac, INIT_PARAMS);
    6060         wac.start();
    6161    }
     
    156156        String path = '/'+ appName;
    157157        for (int i = 0; i < handlers.length; i++) {
     158            if (!(handlers[i] instanceof ContextHandler))
     159                continue;
    158160            ContextHandler ch = (ContextHandler) handlers[i];
    159161            if (path.equals(ch.getContextPath()))
  • apps/routerconsole/jsp/error.jsp

    r8857fe5 r56eba28a  
    55<%
    66    // Let's make this easy...
    7     final Integer ERROR_CODE = (Integer) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_STATUS_CODE);
    8     final String ERROR_URI = (String) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_REQUEST_URI);
    9     final String ERROR_MESSAGE = (String) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_MESSAGE);
     7    final Integer ERROR_CODE = (Integer) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_STATUS_CODE);
     8    final String ERROR_URI = (String) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_REQUEST_URI);
     9    final String ERROR_MESSAGE = (String) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_MESSAGE);
    1010    if (ERROR_CODE != null && ERROR_MESSAGE != null) {
    1111        // this is deprecated but we don't want sendError()
  • apps/routerconsole/jsp/error500.jsp

    r8857fe5 r56eba28a  
    44<%
    55    // Let's make this easy...
    6     final Integer ERROR_CODE = (Integer) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_STATUS_CODE);
    7     final String ERROR_URI = (String) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_REQUEST_URI);
    8     final String ERROR_MESSAGE = (String) request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_MESSAGE);
    9     final Class ERROR_CLASS = (Class)request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_EXCEPTION_TYPE);
    10     final Throwable ERROR_THROWABLE = (Throwable)request.getAttribute(org.mortbay.jetty.servlet.ServletHandler.__J_S_ERROR_EXCEPTION);
     6    final Integer ERROR_CODE = (Integer) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_STATUS_CODE);
     7    final String ERROR_URI = (String) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_REQUEST_URI);
     8    final String ERROR_MESSAGE = (String) request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_MESSAGE);
     9    final Class ERROR_CLASS = (Class)request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_EXCEPTION_TYPE);
     10    final Throwable ERROR_THROWABLE = (Throwable)request.getAttribute(org.eclipse.jetty.server.Dispatcher.ERROR_EXCEPTION);
    1111    if (ERROR_CODE != null && ERROR_MESSAGE != null) {
    1212        // this is deprecated but we don't want sendError()
  • apps/susimail/build.xml

    r8857fe5 r56eba28a  
    2626                <pathelement location="../jetty/jettylib/org.mortbay.jetty.jar" />
    2727                <pathelement location="../jetty/jettylib/jetty-util.jar" />
     28                <pathelement location="../jetty/jettylib/jetty-http.jar" />
    2829                <pathelement location="../../core/java/build/i2p.jar" />
    2930            </classpath>
  • apps/susimail/src/src/org/mortbay/servlet/MultiPartRequest.java

    r8857fe5 r56eba28a  
    3030//import org.apache.commons.logging.Log;
    3131//import org.mortbay.log.LogFactory;
    32 import org.mortbay.jetty.HttpHeaders;
     32import org.eclipse.jetty.http.HttpHeaders;
     33import org.eclipse.jetty.util.MultiMap;
     34import org.eclipse.jetty.util.StringUtil;
    3335import org.mortbay.util.LineInput;
    34 import org.mortbay.util.MultiMap;
    35 import org.mortbay.util.StringUtil;
    3636
    3737/* ------------------------------------------------------------ */
  • build.xml

    r8857fe5 r56eba28a  
    10411041        <exec executable="sh" osfamily="unix" failonerror="true">
    10421042            <arg value="-c" />
    1043             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
     1043            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    10441044        </exec>
    10451045        <exec executable="sh" osfamily="mac" failonerror="true">
    10461046            <arg value="-c" />
    1047             <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
     1047            <arg value="for i in pkg-temp/lib/*.jar pkg-temp/webapps/*war; do if [ $i = pkg-temp/lib/jasper-compiler.jar -o $i = pkg-temp/lib/jbigi.jar -o $i = pkg-temp/lib/jetty-java5-threadpool.jar -o $i = pkg-temp/lib/jetty-sslengine.jar ]; then continue; fi; echo pack200 $i; mv $i $i.jar; pack200 -g $i.pack $i.jar; rm -f $i.jar; done" />
    10481048        </exec>
    10491049        <!-- windoz here : i admit, i hate escaped symbols in xml, indeed = =! -->
     
    11541154              can't overwrite an existing eepsite dir in a non-split configuration.
    11551155          -->
    1156         <copy todir="pkg-temp/eepsite-jetty6" >
     1156        <copy todir="pkg-temp/eepsite-jetty7" >
    11571157            <fileset dir="installer/resources/eepsite" includes="*.xml contexts/* etc/*" />
    11581158        </copy>
     
    11601160
    11611161    <target name="delete-j6-update">
    1162         <delete dir="pkg-temp/eepsite-jetty6" />
     1162        <delete dir="pkg-temp/eepsite-jetty7" />
    11631163    </target>
    11641164
  • installer/resources/clients.config

    r8857fe5 r56eba28a  
    4141
    4242# run our own eepsite with a seperate jetty instance
    43 clientApp.3.main=org.mortbay.start.Main
     43clientApp.3.main=net.i2p.jetty.JettyStart
    4444clientApp.3.name=I2P webserver (eepsite)
    4545## To use the rewrite handler, edit jetty-rewrite.xml and use:
  • installer/resources/eepsite/contexts/base-context.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0"  encoding="ISO-8859-1"?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
    44<!--
    55Configure a custom context for the eepsite.
    66
    7 This context contains only a Context with a default servlet
     7This context contains only a ServletContextHandler with a default servlet
    88to serve static html files and images.
    99-->
    1010
    11 <Configure class="org.mortbay.jetty.servlet.Context">
     11<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
    1212  <Set name="contextPath">/</Set>
    1313  <Set name="resourceBase">./eepsite/docroot/</Set>
    14   <Call name="setInitParams">
    15     <Arg>
    16       <Map>
    17         <Entry>
    18           <Item>org.mortbay.jetty.servlet.Default.cacheControl</Item>
    19           <Item>max-age=3600,public</Item>
    20         </Entry>
    21       </Map>
    22     </Arg>
     14  <Call name="setInitParameter">
     15    <Arg>cacheControl</Arg>
     16    <Arg>max-age=3600,public</Arg>
    2317  </Call>
    2418  <Call name="setMimeTypes">
    2519    <Arg>
    26       <New class="org.mortbay.jetty.MimeTypes">
     20      <New class="org.eclipse.jetty.http.MimeTypes">
    2721        <Call name="addMimeMapping">
    2822          <Arg>sud</Arg>
     
    4135  </Call>
    4236  <Call name="addServlet">
    43     <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
     37    <Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
    4438    <Arg>/</Arg>
    4539  </Call>
  • installer/resources/eepsite/contexts/cgi-context.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0"  encoding="ISO-8859-1"?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
    44<!--
     
    2323-->
    2424
    25 <Configure class="org.mortbay.jetty.servlet.Context">
     25<Configure class="org.eclipse.jetty.servlet.ServletContextHandler">
    2626  <Set name="contextPath">/cgi-bin</Set>
    2727  <Set name="resourceBase">./eepsite/cgi-bin/</Set>
    28   <Call name="setInitParams">
    29     <Arg>
    30       <Map>
    31         <Entry>
    32           <Item>Path</Item>
    33           <Item>/usr/local/bin:/bin:/usr/bin</Item>
    34         </Entry>
    35       </Map>
    36     </Arg>
     28  <Call name="setInitParameter">
     29    <Arg>Path</Arg>
     30    <Arg>/usr/local/bin:/bin:/usr/bin</Arg>
    3731  </Call>
    3832  <Call name="addServlet">
    39     <Arg>org.mortbay.servlet.CGI</Arg>
     33    <Arg>org.eclipse.jetty.servlets.CGI</Arg>
    4034    <Arg>/</Arg>
    4135  </Call>
  • installer/resources/eepsite/etc/webdefault.xml

    r8857fe5 r56eba28a  
    3636  <!-- UNCOMMENT TO ACTIVATE
    3737  <context-param>
    38     <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
     38    <param-name>org.eclipse.jetty.servlet.SessionDomain</param-name>
    3939    <param-value>127.0.0.1</param-value>
    4040  </context-param>
    4141
    4242  <context-param>
    43     <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
     43    <param-name>org.eclipse.jetty.servlet.SessionPath</param-name>
    4444    <param-value>/</param-value>
    4545  </context-param>
    4646
    4747  <context-param>
    48     <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
     48    <param-name>org.eclipse.jetty.servlet.MaxAge</param-name>
    4949    <param-value>-1</param-value>
    5050  </context-param>
     
    5252
    5353  <context-param>
    54     <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name>
     54    <param-name>org.eclipse.jetty.webapp.NoTLDJarPattern</param-name>
    5555    <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</param-value>
    5656  </context-param>
     
    113113  <servlet>
    114114    <servlet-name>default</servlet-name>
    115     <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class>
     115    <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
    116116    <init-param>
    117117      <param-name>acceptRanges</param-name>
     
    307307  <servlet>
    308308    <servlet-name>invoker</servlet-name>
    309     <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class>
     309    <servlet-class>org.eclipse.jetty.servlet.Invoker</servlet-class>
    310310    <init-param>
    311311      <param-name>verbose</param-name>
  • installer/resources/eepsite/jetty-jmx.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0"?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
     4<!-- ============================================================================ -->
     5<!-- To correctly start Jetty with JMX module enabled, this configuration         -->
     6<!-- file must appear first in the list of the configuration files.               -->
     7<!-- The simplest way to achieve this is to add etc/jetty-jmx.xml as the          -->
     8<!-- first file in configuration file list at the end of start.ini file.          -->
     9<!-- ============================================================================ -->
     10<Configure id="Server" class="org.eclipse.jetty.server.Server">
    411
    5 <!-- =============================================================== -->
    6 <!-- Configure the JVM JMX Server                                    -->
    7 <!-- this configuration file should be used in combination with      -->
    8 <!-- other configuration files.  e.g.                                -->
    9 <!--    java -jar start.jar etc/jetty-jmx.xml etc/jetty.xml          -->
    10 <!-- See jetty-jmx-mx4j.xml for a non JVM server solution            -->
    11 <!-- =============================================================== -->
    12 <Configure id="Server" class="org.mortbay.jetty.Server">
     12  <!-- =========================================================== -->
     13  <!-- Set the java.rmi.server.hostname property in case you've    -->
     14  <!-- got a misconfigured /etc/hosts entry or the like.           -->
     15  <!-- =========================================================== -->
     16  <!--
     17  <Call class="java.lang.System" name="setProperty">
     18    <Arg>java.rmi.server.hostname</Arg>
     19    <Arg>127.0.0.1</Arg>
     20  </Call>
     21  -->
     22 
     23  <!-- =========================================================== -->
     24  <!-- Initialize an mbean server                                  -->
     25  <!-- =========================================================== -->
     26  <Call id="MBeanServer" class="java.lang.management.ManagementFactory"
     27    name="getPlatformMBeanServer" />
    1328
    14     <!-- =========================================================== -->
    15     <!-- Initialize an mbean server                                  -->
    16     <!-- =========================================================== -->
    17     <!-- Use the jdk 1.5 platformMBeanServer -->
    18     <Call id="MBeanServer" class="java.lang.management.ManagementFactory" name="getPlatformMBeanServer"/>
     29  <!-- =========================================================== -->
     30  <!-- Initialize the Jetty MBean container                        -->
     31  <!-- =========================================================== -->
     32  <New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
     33    <Arg><Ref id="MBeanServer" /></Arg>
     34    <Call name="start"/>
     35  </New>
    1936
    20     <!-- =========================================================== -->
    21     <!-- Initialize the Jetty MBean container                        -->
    22     <!-- =========================================================== -->
    23     <Get id="Container" name="container">
    24       <Call name="addEventListener">
    25         <Arg>
    26           <New class="org.mortbay.management.MBeanContainer">
    27             <Arg><Ref id="MBeanServer"/></Arg>
    28             <Call name="start" />
    29           </New>
    30         </Arg>
    31       </Call>
    32     </Get>
     37  <!-- Add to the Server to listen for object events -->
     38  <Get id="Container" name="container">
     39    <Call name="addEventListener">
     40      <Arg><Ref id="MBeanContainer" /></Arg>
     41    </Call>
     42  </Get>
    3343
    34     <!-- =========================================================== -->
    35     <!-- Enable stats (why else are you using JMX?                                -->
    36     <!-- Sneakily replace the top-level handler with a StatisticsHandler          -->
    37     <!-- Note we could use AtomicStatisticsHandler in jetty-java5-stats.jar (4KB) -->
    38     <!-- but it really isn't worth bundling it.                                   -->
    39     <!-- http://blog.markfeeney.com/2010/10/jmx-statistics-in-jetty-6-6122.html   -->
    40     <!-- =========================================================== -->
    41     <Get id="oldhandler" name="handler"/>
    42     <Set name="handler">
    43       <New id="StatsHandler" class="org.mortbay.jetty.handler.StatisticsHandler">
    44         <Set name="handler"><Ref id="oldhandler"/></Set>
     44  <!-- Add to the Server as a managed lifecycle -->
     45  <Call name="addBean">
     46    <Arg><Ref id="MBeanContainer"/></Arg>
     47    <Arg type="boolean">true</Arg>
     48  </Call>
     49
     50  <!-- Add the static log -->
     51  <Ref id="MBeanContainer">
     52    <Call name="addBean">
     53      <Arg>
     54        <New class="org.eclipse.jetty.util.log.Log"/>
     55      </Arg>
     56    </Call>
     57  </Ref>
     58 
     59  <!-- In order to connect to the JMX server remotely from a different
     60       process, possibly running on a different host, Jetty JMX module
     61       can create a remote JMX connector. It requires RMI registry to
     62       be started prior to creating the connector server because the
     63       JMX specification uses RMI to facilitate connections.       
     64   -->
     65
     66  <!-- Optionally start the RMI registry. Normally RMI registry runs on
     67       port 1099. The argument below can be changed in order to comply
     68       with the firewall requirements.
     69  -->
     70  <!--
     71  <Call name="createRegistry" class="java.rmi.registry.LocateRegistry">
     72    <Arg type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport" default="1099"/></Arg>
     73    <Call name="sleep" class="java.lang.Thread">
     74       <Arg type="java.lang.Integer">1000</Arg>
     75    </Call>
     76  </Call>
     77  -->
     78 
     79  <!-- Optionally add a remote JMX connector. The parameters of the constructor
     80       below specify the JMX service URL, and the object name string for the
     81       connector server bean. The parameters of the JMXServiceURL constructor
     82       specify the protocol that clients will use to connect to the remote JMX
     83       connector (RMI), the hostname of the server (local hostname), port number
     84       (automatically assigned), and the URL path. Note that URL path contains
     85       the RMI registry hostname and port number, that may need to be modified
     86       in order to comply with the firewall requirements.
     87  -->
     88  <!--
     89  <New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
     90    <Arg>
     91      <New class="javax.management.remote.JMXServiceURL">
     92        <Arg type="java.lang.String">rmi</Arg>
     93        <Arg type="java.lang.String" />
     94        <Arg type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport" default="1099"/></Arg>
     95        <Arg type="java.lang.String">/jndi/rmi://<SystemProperty name="jetty.jmxrmihost" default="localhost"/>:<SystemProperty name="jetty.jmxrmiport" default="1099"/>/jmxrmi</Arg>
    4596      </New>
    46     </Set>
    47 
    48 
    49     <!--
    50     When setting up the JMXConnectorServer via RMI, two TCP ports are used to communicate with
    51     the remote server:
    52     * the rmiregistry port (by default 1099) from where the RMI stub is downloaded
    53     * the rmi server port (by default randomly chosen) where the actual RMI communication happens
    54     The JMXServiceURL for the default configuration is therefore:
    55 
    56     service:jmx:rmi:///jndi/rmi://<remotehost>:1099/jmxrmi
    57 
    58     In case a firewall is restricting port access, you need to make sure that the rmi server port
    59     is not chosen randomly, and this can be specified with the following JMXServiceURL:
    60 
    61     service:jmx:rmi://<host>:2100/jndi/rmi://<host>:2099/jmxrmi
    62 
    63     where 2099 is the rmiregistry port and 2100 is the rmi server port.
    64     Make sure the firewall allow access to those ports.
    65 
    66     When using the XML configuration below, you don't need to specify any of the JMX system properties
    67     on the command line (see http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html).
    68     -->
    69 
    70     <!-- Setup the RMIRegistry on a specific port
    71     <Call id="rmiRegistry" class="java.rmi.registry.LocateRegistry" name="createRegistry">
    72       <Arg type="int">2099</Arg>
    73     </Call>
    74     -->
    75     <!-- Setup the JMXConnectorServer on a specific rmi server port
    76     <Call id="jmxConnectorServer" class="javax.management.remote.JMXConnectorServerFactory" name="newJMXConnectorServer">
    77       <Arg>
    78         <New  class="javax.management.remote.JMXServiceURL">
    79           <Arg>service:jmx:rmi://localhost:2100/jndi/rmi://localhost:2099/jmxrmi</Arg>
    80         </New>
    81       </Arg>
    82       <Arg/>
    83       <Arg><Ref id="MBeanServer"/></Arg>
    84       <Call name="start"/>
    85     </Call>
    86     -->
    87 
     97    </Arg>
     98    <Arg>org.eclipse.jetty.jmx:name=rmiconnectorserver</Arg>
     99    <Call name="start" />
     100  </New>
     101  -->
    88102</Configure>
    89103
  • installer/resources/eepsite/jetty-rewrite.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0"?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
    44<!-- =============================================================== -->
     
    77
    88
    9 <Configure id="Server" class="org.mortbay.jetty.Server">
     9<Configure id="Server" class="org.eclipse.jetty.server.Server">
    1010
    1111    <!-- =========================================================== -->
    12     <!-- Configure Rewrite Handler                                   -->
     12    <!-- configure rewrite handler                                   -->
    1313    <!-- =========================================================== -->
    1414    <Get id="oldhandler" name="handler"/>
    1515
    1616    <Set name="handler">
    17      <New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">
    18      
     17     <New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
    1918      <Set name="handler"><Ref id="oldhandler"/></Set>
    2019      <Set name="rewriteRequestURI">true</Set>
     
    2221      <Set name="originalPathAttribute">requestedPath</Set>
    2322
    24       <Set name="rules">
    25           <Array type="org.mortbay.jetty.handler.rewrite.Rule">
     23      <!-- Add rule to protect against IE ssl bug -->
     24      <Call name="addRule">
     25        <Arg>
     26          <New class="org.eclipse.jetty.rewrite.handler.MsieSslRule"/>
     27        </Arg>
     28      </Call>
    2629
    27            <!-- return an error message if low on threads; put this at the top so it will be processed first -->
    28            <Item>
    29              <New id="lowThreads" class="org.mortbay.jetty.handler.rewrite.LowThreadsRuleContainer">               
    30                 <!-- set the trigger for low threads ridiculously low
    31                 uncomment the block below to see it in action -->
    32                 <!--Ref id="Server">
    33                   <Get id="serverThreadPool" name="threadPool">
    34                     <Set name="minThreads">3</Set>
    35                     <Set name="maxThreads">4</Set>
    36                     <Set name="lowThreads">0</Set>
    37                   </Get>
    38                 </Ref>
     30      <!-- protect favicon handling -->
     31      <Call name="addRule">
     32        <Arg>
     33          <New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
     34            <Set name="pattern">/favicon.ico</Set>
     35            <Set name="name">Cache-Control</Set>
     36            <Set name="value">Max-Age=3600,public</Set>
     37            <Set name="terminating">true</Set>
     38          </New>
     39        </Arg>
     40      </Call>
    3941
    40                 <Set name="threadPool"><Ref id="serverThreadPool"/></Set-->
    41                
    42                 <Call name="addRule">
    43                   <Arg>
    44                     <New id="busyresponse" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule">
    45                         <Set name="pattern">/*</Set>
    46                         <Set name="code">500</Set>
    47                         <Set name="reason">Server busy</Set>
    48                    </New>
    49                   </Arg>
    50                 </Call>
    51              </New>
    52            </Item>
     42      <!-- redirect from the welcome page to a specific page -->
     43      <Call name="addRule">
     44        <Arg>
     45          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
     46            <Set name="pattern">/rewrite/</Set>
     47            <Set name="replacement">/rewrite/info.html</Set>
     48          </New>
     49        </Arg>
     50      </Call>
    5351
    54             <!-- Add rule to protect against IE ssl bug -->
    55             <Item>
    56               <New class="org.mortbay.jetty.handler.rewrite.MsieSslRule"/>
    57             </Item>
     52      <!-- replace the entire request URI -->
     53      <Call name="addRule">
     54        <Arg>
     55          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
     56            <Set name="pattern">/some/old/context</Set>
     57            <Set name="replacement">/rewritten/newcontext</Set>
     58          </New>
     59        </Arg>
     60      </Call>
    5861
    59             <!-- protect favicon handling -->
    60             <Item>
    61               <New class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
    62                 <Set name="pattern">/favicon.ico</Set>
    63                 <Set name="name">Cache-Control</Set>
    64                 <Set name="value">Max-Age=3600,public</Set>
    65                 <Set name="terminating">true</Set>
    66               </New>
    67             </Item>
     62      <!-- replace the beginning of the request URI -->
     63      <Call name="addRule">
     64        <Arg>
     65          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
     66            <Set name="pattern">/rewrite/for/*</Set>
     67            <Set name="replacement">/rewritten/</Set>
     68          </New>
     69        </Arg>
     70      </Call>
     71     
     72      <!-- reverse the order of the path sections -->
     73      <Call name="addRule">
     74        <Arg>
     75          <New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
     76            <Set name="regex">(.*?)/reverse/([^/]*)/(.*)</Set>
     77            <Set name="replacement">$1/reverse/$3/$2</Set>
     78          </New>
     79        </Arg>
     80      </Call>
    6881
     82      <!-- add a cookie to each path visited -->
     83      <Call name="addRule">
     84        <Arg>
     85          <New class="org.eclipse.jetty.rewrite.handler.CookiePatternRule">
     86            <Set name="pattern">/*</Set>
     87            <Set name="name">visited</Set>
     88            <Set name="value">yes</Set>
     89          </New>
     90        </Arg>
     91      </Call>
     92     
     93      <!--  actual redirect, instead of internal rewrite -->
     94      <Call name="addRule">
     95        <Arg>
     96          <New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
     97            <Set name="pattern">/redirect/*</Set>
     98            <Set name="location">/redirected</Set>
     99          </New>
     100        </Arg>
     101      </Call>
    69102
    70             <!-- add a regex rule -->
    71             <Item>
    72               <New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule">
    73                 <Set name="regex">/rewrite/dump/regex/([^/]*)/(.*)</Set>
    74                 <Set name="replacement">/test/dump/$2/$1</Set>
    75               </New>
    76             </Item>
     103      <!-- add a response rule -->
     104      <Call name="addRule">
     105        <Arg>
     106           <New class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
     107             <Set name="pattern">/400Error</Set>
     108             <Set name="code">400</Set>
     109             <Set name="reason">ResponsePatternRule Demo</Set>
     110          </New>
     111        </Arg>
     112      </Call>
    77113
    78             <!-- add a rewrite rule -->
    79             <Item>
    80               <New id="" class="org.mortbay.jetty.handler.rewrite.RewritePatternRule">
    81                 <Set name="pattern">/rewrite</Set>
    82                 <Set name="replacement">/rewrittento</Set>
    83               </New>
    84             </Item>
    85            
    86             <!-- add a response rule -->
    87             <Item>
    88               <New id="response" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule">
    89                 <Set name="pattern">/rewrite/session/</Set>
    90                 <Set name="code">401</Set>
    91                 <Set name="reason">Setting error code 401</Set>
    92               </New>
    93             </Item>
    94 
    95             <!-- add a header pattern rule -->
    96             <Item>
    97               <New id="header" class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
    98                 <Set name="pattern">*.jsp</Set>
    99                 <Set name="name">Server</Set>
    100                 <Set name="value">Server for JSP</Set>
    101               </New>
    102             </Item>
    103 
    104             <!-- add a redirect -->
    105             <Item>
    106               <New id="redirect" class="org.mortbay.jetty.handler.rewrite.RedirectPatternRule">
    107                 <Set name="pattern">/rewrite/dispatch</Set>
    108                 <Set name="location">http://jetty.mortbay.org</Set>
    109               </New>
    110             </Item>
    111 
    112             <Item>
    113               <New id="forwardedHttps" class="org.mortbay.jetty.handler.rewrite.ForwardedSchemeHeaderRule">
    114                 <Set name="header">X-Forwarded-Scheme</Set>
    115                 <Set name="headerValue">https</Set>
    116                 <Set name="scheme">https</Set>
    117               </New>
    118             </Item>
    119 
    120             <Item>
    121               <New id="virtualHost" class="org.mortbay.jetty.handler.rewrite.VirtualHostRuleContainer">
    122 
    123                 <Set name="virtualHosts">
    124                   <Array type="java.lang.String">
    125                     <Item>mortbay.com</Item>
    126                     <Item>www.mortbay.com</Item>
    127                     <Item>mortbay.org</Item>
    128                     <Item>www.mortbay.org</Item>
    129                   </Array>
    130                 </Set>
    131 
    132                 <Call name="addRule">
    133                   <Arg>
    134                     <New class="org.mortbay.jetty.handler.rewrite.CookiePatternRule">
    135                       <Set name="pattern">/*</Set>
    136                       <Set name="name">CookiePatternRule</Set>
    137                       <Set name="value">1</Set>
    138                     </New>
    139                   </Arg>
    140                 </Call>
    141      
    142              </New>
    143            </Item>           
    144           </Array>
    145         </Set>
    146       </New>
     114     </New>
    147115    </Set>
    148116   
  • installer/resources/eepsite/jetty-ssl.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0"?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
    44<!-- =============================================================== -->
     
    66<!-- this configuration file should be used in combination with      -->
    77<!-- other configuration files.  e.g.                                -->
    8 <!--    java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml          -->
     8<!--    java -jar start.jar etc/jetty-ssl.xml                        -->
     9<!--                                                                 -->
     10<!--  alternately, add to the start.ini for easier usage             -->
    911<!-- =============================================================== -->
    10 <Configure id="Server" class="org.mortbay.jetty.Server">
     12<Configure id="Server" class="org.eclipse.jetty.server.Server">
    1113
    12 
     14  <!-- if NIO is not available, use org.eclipse.jetty.server.ssl.SslSocketConnector -->
     15 
     16  <New id="sslContextFactory" class="org.eclipse.jetty.http.ssl.SslContextFactory">
     17    <Set name="KeyStore">./eepsite/etc/keystore</Set>
     18    <Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
     19    <Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
     20    <Set name="TrustStore">./eepsite/etc/keystore</Set>
     21    <Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
     22  </New>
    1323
    1424  <Call name="addConnector">
    1525    <Arg>
    16       <New class="org.mortbay.jetty.security.SslSocketConnector">
     26      <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
     27        <Arg><Ref id="sslContextFactory" /></Arg>
    1728        <Set name="Port">8443</Set>
    1829        <Set name="maxIdleTime">30000</Set>
    1930        <Set name="useDirectBuffers">false</Set>
    20         <Set name="handshakeTimeout">2000</Set>
    21         <Set name="keystore">./eepsite/etc/keystore.ks</Set>
    22         <Set name="password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
    23         <Set name="keyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
    24         <Set name="truststore">./eepsite/etc/keystore.ks</Set>
    25         <Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
    26         <Set name="handshakeTimeout">2000</Set>
    27         <!-- Set name="ThreadPool">
    28           <New class="org.mortbay.thread.QueuedThreadPool">
    29             <Set name="minThreads">0</Set>
    30             <Set name="maxThreads">16</Set>
    31          </New>
    32         </Set -->
     31        <Set name="Acceptors">2</Set>
     32        <Set name="AcceptQueueSize">100</Set>
    3333      </New>
    3434    </Arg>
  • installer/resources/eepsite/jetty.xml

    r8857fe5 r56eba28a  
    11<?xml version="1.0" encoding="UTF-8" ?>
    2 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">
     2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
    33
    44<!-- ========================================================================= -->
     
    1919<!--   * Uncomment the line to allow Jetty to follow symlinks                  -->
    2020<!--                                                                           -->
    21 <!-- I2P uses Jetty 6.1.26. If you need web server features not found          -->
    22 <!-- in Jetty 6, you may install and run Jetty 7 or 8 in a different JVM       -->
     21<!-- I2P uses Jetty 7. If you need web server features not found               -->
     22<!-- in Jetty 7, you may install and run Jetty 7 or 8 in a different JVM       -->
    2323<!-- or run any other web server such as Apache. If you do run another web     -->
    2424<!-- server instead, be sure and disable the Jetty 6 server for your           -->
     
    4545
    4646
    47 <Configure id="Server" class="org.mortbay.jetty.Server">
     47<Configure id="Server" class="org.eclipse.jetty.server.Server">
    4848
    4949    <!-- =========================================================== -->
     
    5858       -->
    5959     <!--
    60       <New class="org.mortbay.thread.QueuedThreadPool">
     60      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
    6161        <Set name="minThreads">1</Set>
    6262        <Set name="maxThreads">16</Set>
     
    7474           See RouterConsoleRunner.
    7575       -->
    76       <New class="org.mortbay.thread.concurrent.ThreadPool">
    77         <Arg type="int">0</Arg>
    78         <Set name="corePoolSize">1</Set>
    79         <Set name="maximumPoolSize">24</Set>
     76      <New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
     77        <!-- corePoolSize (must be at least 3) -->
     78        <Arg type="int">3</Arg>
     79        <!-- maximumPoolSize -->
     80        <Arg type="int">16</Arg>
     81        <!-- keepAliveTime (milliseconds) -->
     82        <Arg type="long">60000</Arg>
    8083      </New>
    8184    </Set>
     
    98101    <Call name="addConnector">
    99102      <Arg>
    100           <New class="org.mortbay.jetty.nio.SelectChannelConnector">
     103          <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
    101104            <Set name="host">127.0.0.1</Set>
    102105            <Set name="port">7658</Set>
     
    107110            <Set name="lowResourcesConnections">5000</Set>
    108111            <Set name="lowResourcesMaxIdleTime">5000</Set>
    109             <Set name="useDirectBuffers">false</Set>
     112            <Set name="useDirectBuffers">false</Set>
    110113          </New>
    111114      </Arg>
     
    118121    <Call name="addConnector">
    119122      <Arg>
    120           <New class="org.mortbay.jetty.bio.SocketConnector">
     123          <New class="org.eclipse.jetty.server.bio.SocketConnector">
    121124            <Set name="host">127.0.0.1</Set>
    122125            <Set name="port">7658</Set>
     
    156159    <!--
    157160    <Set name="sessionIdManager">
    158       <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
     161      <New class="org.eclipse.jetty.server.session.HashSessionIdManager">
    159162        <Set name="workerName">node1</Set>
    160163      </New>
     
    166169    <!-- =========================================================== -->
    167170    <Set name="handler">
    168       <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
     171      <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
    169172        <Set name="handlers">
    170          <Array type="org.mortbay.jetty.Handler">
     173         <Array type="org.eclipse.jetty.server.Handler">
    171174           <Item>
    172              <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
     175             <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
    173176           </Item>
    174177           <Item>
    175              <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
     178             <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
    176179           </Item>
    177180           <Item>
    178              <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
     181             <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
    179182           </Item>
    180183         </Array>
     
    182185      </New>
    183186    </Set>
    184    
     187
     188    <!-- =============================================================== -->
     189    <!-- Create the deployment manager                                   -->
     190    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
     191    <!-- The deplyment manager handles the lifecycle of deploying web    -->
     192    <!-- applications. Apps are provided by instances of the             -->
     193    <!-- AppProvider interface.  Typically these are provided by         -->
     194    <!-- one or more of:                                                 -->
     195    <!--   jetty-webapps.xml       - monitors webapps for wars and dirs  -->
     196    <!--   jetty-contexts.xml      - monitors contexts for context xml   -->
     197    <!--   jetty-templates.xml     - monitors contexts and templates     -->
     198    <!-- =============================================================== -->
     199    <Call name="addBean">
     200      <Arg>
     201        <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
     202          <Set name="contexts">
     203            <Ref id="Contexts" />
     204          </Set>
     205          <Call name="setContextAttribute">
     206            <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
     207            <Arg>.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg>
     208          </Call>
     209        </New>
     210      </Arg>
     211    </Call>
     212
    185213    <!-- =========================================================== -->
    186214    <!-- Configure the context deployer                              -->
     
    194222    <!--                                                             -->
    195223    <!-- =========================================================== -->
    196     <Call name="addLifeCycle">
    197       <Arg>
    198         <New class="org.mortbay.jetty.deployer.ContextDeployer">
    199           <Set name="contexts"><Ref id="Contexts"/></Set>
    200           <Set name="configurationDir">./eepsite/contexts</Set>
    201           <!-- set to 60 to have it check for changes once a minute -->
    202           <Set name="scanInterval">0</Set>
    203         </New>
    204       </Arg>
    205     </Call>
     224    <Ref id="DeploymentManager">
     225      <Call name="addAppProvider">
     226        <Arg>
     227          <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
     228            <Set name="monitoredDirName">./eepsite/contexts</Set>
     229            <Set name="scanInterval">30</Set>
     230          </New>
     231        </Arg>
     232      </Call>
     233    </Ref>
    206234
    207235    <!-- =========================================================== -->
     
    220248    <Call name="addLifeCycle">
    221249      <Arg>
    222         <New class="org.mortbay.jetty.deployer.WebAppDeployer">
     250        <New class="org.eclipse.jetty.deploy.WebAppDeployer">
    223251          <Set name="contexts"><Ref id="Contexts"/></Set>
    224252          <Set name="webAppDir">./eepsite/webapps</Set>
     
    232260    </Call>
    233261
     262<!-- FIXME Above is deprecated, but this doesn't work
     263     java.lang.IllegalStateException: No Method: <Call name="addAppProvider"><New class="org.eclipse.jetty.deploy.providers.WebAppProvider"><Set name="monitoredDirName">./eepsite/webapps</Set><Set name="parentLoaderPriority">false</Set><Set name="extractWars">false</Set><Set name="defaultsDescriptor">./eepsite/etc/webdefault.xml</Set></New></Call> on class org.eclipse.jetty.deploy.DeploymentManager
     264    <Ref id="DeploymentManager">
     265      <Call id="webappprovider" name="addAppProvider">
     266        <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
     267          <Set name="monitoredDirName">./eepsite/webapps</Set>
     268          <Set name="parentLoaderPriority">false</Set>
     269          <Set name="extractWars">false</Set>
     270          <Set name="defaultsDescriptor">./eepsite/etc/webdefault.xml</Set>
     271        </New>
     272      </Call>
     273    </Ref>
     274-->
     275
    234276    <!-- =========================================================== -->
    235277    <!-- Configure Authentication Realms                             -->
     
    241283  <!-- UNCOMMENT TO ACTIVATE
    242284    <Set name="UserRealms">
    243       <Array type="org.mortbay.jetty.security.UserRealm">
     285      <Array type="org.eclipse.jetty.security.LoginService">
    244286        <Item>
    245           <New class="org.mortbay.jetty.security.HashUserRealm">
     287          <New class="org.eclipse.jetty.security.HashLoginService">
    246288            <Set name="name">Test Realm</Set>
    247289            <Set name="config">./eepsite/etc/realm.properties</Set>
  • router/java/src/net/i2p/router/Router.java

    r8857fe5 r56eba28a  
    129129        // The default is true, unfortunately it was previously
    130130        // set to false in wrapper.config thru 0.7.10 so we must set it back here.
    131         System.setProperty("org.mortbay.util.FileResource.checkAliases", "true");
     131        // Not in Jetty 7
     132        //System.setProperty("org.mortbay.util.FileResource.checkAliases", "true");
    132133    }
    133134   
  • router/java/src/net/i2p/router/startup/MigrateJetty.java

    r8857fe5 r56eba28a  
    3636abstract class MigrateJetty {
    3737    private static boolean _wasChecked;
    38     private static boolean _hasJetty6;
     38    private static boolean _hasLatestJetty;
    3939
    4040    private static final String OLD_CLASS = "org.mortbay.jetty.Server";
    41     private static final String NEW_CLASS = "org.mortbay.start.Main";
    42     private static final String BACKUP = "jetty5.xml";
    43     private static final String JETTY6_TEMPLATE_DIR = "eepsite-jetty6";
    44     private static final String JETTY6_TEMPLATE_PKGDIR = "eepsite";
     41    private static final String OLD_CLASS_6 = "org.mortbay.start.Main";
     42    private static final String NEW_CLASS = "net.i2p.jetty.JettyStart";
     43    private static final String TEST_CLASS = "org.eclipse.jetty.server.Server";
     44    private static final String BACKUP = "jetty6.xml";
     45    private static final String JETTY_TEMPLATE_DIR = "eepsite-jetty7";
     46    private static final String JETTY_TEMPLATE_PKGDIR = "eepsite";
    4547    private static final String BASE_CONTEXT = "contexts/base-context.xml";
    4648    private static final String CGI_CONTEXT = "contexts/cgi-context.xml";
     
    5052        for (int i = 0; i < apps.size(); i++) {
    5153            ClientAppConfig app = apps.get(i);
    52             if (!app.className.equals(OLD_CLASS))
     54            if (!(app.className.equals(OLD_CLASS) || app.className.equals(OLD_CLASS_6)))
    5355                continue;
    5456            String client = "client application " + i + " [" + app.clientName +
    55                             "] from Jetty 5 " + OLD_CLASS +
    56                             " to Jetty 6 " + NEW_CLASS;
    57             if (!hasJetty6()) {
    58                 System.err.println("WARNING: Jetty 6 unavailable, cannot migrate " + client);
     57                            "] from Jetty 5/6 " + app.className +
     58                            " to Jetty 7 " + NEW_CLASS;
     59            if (!hasLatestJetty()) {
     60                System.err.println("WARNING: Jetty 7 unavailable, cannot migrate " + client);
    5961                continue;
    6062            }
     
    8486                continue;
    8587            }
    86             File baseEep = new File(ctx.getBaseDir(), JETTY6_TEMPLATE_DIR);
     88            File baseEep = new File(ctx.getBaseDir(), JETTY_TEMPLATE_DIR);
    8789            // in packages, or perhaps on an uninstall/reinstall, the files are in eepsite/
    8890            if (!baseEep.exists())
    89                 baseEep = new File(ctx.getBaseDir(), JETTY6_TEMPLATE_PKGDIR);
     91                baseEep = new File(ctx.getBaseDir(), JETTY_TEMPLATE_PKGDIR);
    9092            if (baseEep.equals(eepsite)) {
    9193                // non-split directory yet not an upgrade? shouldn't happen
     
    133135        if (shouldSave) {
    134136            File cfgFile = ClientAppConfig.configFile(ctx);
    135             File backup = new File(cfgFile.getAbsolutePath() + ".jetty5");
     137            File backup = new File(cfgFile.getAbsolutePath() + ".jetty6");
    136138            if (backup.exists())
    137139                backup = new File(cfgFile.getAbsolutePath() + ctx.random().nextInt());
     
    140142                ClientAppConfig.writeClientAppConfig(ctx, apps);
    141143                System.err.println("WARNING: Migrated clients config file " + cfgFile +
    142                                " from Jetty 5 " + OLD_CLASS +
    143                                " to Jetty 6 " + NEW_CLASS + "\n" +
     144                               " from Jetty 5/6 " + OLD_CLASS + '/' + OLD_CLASS_6 +
     145                               " to Jetty 7 " + NEW_CLASS + "\n" +
    144146                               "Your old clients config file was saved as " + backup);
    145147            }
     
    147149    }
    148150
    149     private static boolean hasJetty6() {
     151    /** do we have Jetty 7? */
     152    private static boolean hasLatestJetty() {
    150153        if (!_wasChecked) {
    151154            try {
    152                 LoadClientAppsJob.testClient(NEW_CLASS, null);
    153                 _hasJetty6 = true;
     155                LoadClientAppsJob.testClient(TEST_CLASS, null);
     156                _hasLatestJetty = true;
    154157            } catch (ClassNotFoundException cnfe) {}
    155158            _wasChecked = true;
    156159        }
    157         return _hasJetty6;
     160        return _hasLatestJetty;
    158161    }
    159162}
Note: See TracChangeset for help on using the changeset viewer.