java.lang.Object
net.i2p.router.web.WebAppConfiguration
All Implemented Interfaces:
Configuration

public class WebAppConfigurationextends Object implements Configuration
Adds to the webapp classpath as specified in webapps.config. This allows us to reference classes that are not in the classpath specified in wrapper.config, since old installations have individual jars and not lib/*.jar specified in wrapper.config.

A sample line in webapps.config is: webapps.appname.classpath=foo.jar,$I2P/lib/bar.jar Unless $I2P is specified the path will be relative to $I2P/lib for webapps in the installation and appDir/plugins/appname/lib for plugins.

webapps.config is used because setting Class-Path in MANIFEST.MF does not work for jetty wars, and because WebAppContext.addClassPath() is not usable here. Jars that are already on the system class path are skipped to avoid duplicate statics; /susimail is the exception.

  • Field Details

    • CLASSPATH

      private static final String CLASSPATH
      Name of the file listing a webapp's extra classpath entries.
      See Also:
  • Constructor Details

    • WebAppConfiguration

      public WebAppConfiguration()
      configure(WebAppContext) takes the WebAppContext it is configuring as an argument, so a bare instance is how Jetty creates it.
  • Method Details

    • configureClassPath

      private void configureClassPath(WebAppContext wac) throws Exception
      This was the interface in Jetty 5, in Jetty 6 was configureClassLoader(), now it's configure().
      Parameters:
      wac - the web app context to set the extra classpath on
      Throws:
      Exception - if the plugin's webapp properties cannot be read
    • getSystemClassPath

      private static Set<URI> getSystemClassPath(I2PAppContext ctx)
      Convert URL to URI so there's no blocking equals(), not that there's really any hostnames in here, but keep findbugs happy.
      Parameters:
      ctx - the context, used to locate the lib directory on Java 9 and later
      Returns:
      the system class path
    • deconfigure

      public void deconfigure(WebAppContext context)
      Jetty 7 Configuration hook. Nothing to undo - this configuration only adjusts the class path, which Jetty owns.
      Specified by:
      deconfigure in interface Configuration
    • configure

      public void configure(WebAppContext context) throws Exception
      Apply I2P security settings to the webapp.
      Specified by:
      configure in interface Configuration
      Throws:
      Exception
    • cloneConfigure

      public void cloneConfigure(WebAppContext template, WebAppContext context)
      Apply the same settings to a cloned webapp.
      Specified by:
      cloneConfigure in interface Configuration
    • destroy

      public void destroy(WebAppContext context)
      Jetty 7 Configuration hook. Nothing to destroy - this configuration holds no resources.
      Specified by:
      destroy in interface Configuration
    • preConfigure

      public void preConfigure(WebAppContext context)
      Jetty 7 Configuration hook. Runs before configure(WebAppContext) with no class path work to do, so this is an intentional no-op.
      Specified by:
      preConfigure in interface Configuration
    • postConfigure

      public void postConfigure(WebAppContext context)
      Jetty 7 Configuration hook. Runs after configure(WebAppContext) with no follow-up work, so this is an intentional no-op.
      Specified by:
      postConfigure in interface Configuration