Changeset 76c0f56


Ignore:
Timestamp:
Mar 5, 2012 12:41:36 AM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3240dac
Parents:
d85ae48
Message:
  • Plugins: Fix setting webapp classpath on Jetty 6
File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    rd85ae48 r76c0f56  
    88
    99import org.mortbay.jetty.webapp.Configuration;
     10import org.mortbay.jetty.webapp.WebAppClassLoader;
    1011import org.mortbay.jetty.webapp.WebAppContext;
    1112
     
    4647    }
    4748
    48     public void configureClassPath() throws Exception {
     49    /**
     50     *  This was the interface in Jetty 5, now it's configureClassLoader()
     51     */
     52    private void configureClassPath() throws Exception {
    4953        String ctxPath = _wac.getContextPath();
    5054        //System.err.println("Configure Class Path " + ctxPath);
     
    7983            return;
    8084        StringTokenizer tok = new StringTokenizer(cp, " ,");
     85        StringBuilder buf = new StringBuilder();
    8186        while (tok.hasMoreTokens()) {
     87            if (buf.length() > 0)
     88                buf.append(',');
    8289            String elem = tok.nextToken().trim();
    8390            String path;
     
    8996                path = dir.getAbsolutePath() + '/' + elem;
    9097            System.err.println("Adding " + path + " to classpath for " + appName);
    91             _wac.setExtraClasspath(path);
     98            buf.append(path);
     99        }
     100        ClassLoader cl = _wac.getClassLoader();
     101        if (cl != null && cl instanceof WebAppClassLoader) {
     102            WebAppClassLoader wacl = (WebAppClassLoader) cl;
     103            wacl.addClassPath(buf.toString());
     104        } else {
     105            // This was not working because the WebAppClassLoader already exists
     106            // and it calls getExtraClasspath in its constructor
     107            // Not sure why WACL already exists...
     108            _wac.setExtraClasspath(buf.toString());
    92109        }
    93110    }
     
    100117
    101118    /** @since Jetty 6 */
    102     public void configureClassLoader() {}
     119    public void configureClassLoader() throws Exception {
     120        configureClassPath();
     121    }
    103122}
Note: See TracChangeset for help on using the changeset viewer.