Jetty: accessing classes under WEB-INF/ before

2019-08-11 06:44发布

I'm trying a self-executable WAR package with Jetty. It is configured with web.xml by default, but with some options, it would be configured with my own Java code like:

if (configureWithWebXml) {
  webapp.setConfigurationClasses(
    WebAppContext.getDefaultConfigurationClasses());
} else {
  webapp.setConfigurations(new Configuration[] { 
    new MyOriginalConfigurationWithoutWebXml()
  });
}
...
Server server = new Server();
server.setHandler(webapp);
server.start();

The question is, how can I access classes under WEB-INF/ before server.start()? Classes under WEB-INF/ don't look loaded before server.start(). I couldn't do some configuration like:

...addEventListener(new SomeClassUnderWebInf()));

Related question: Ignoring web.xml when loading a WAR file with Jetty

0条回答
登录 后发表回答