One thing you can do is manually add your plugin as a webapp to Jetty. We use this trick in Fastpath. Here’'s an example:
public void initializePlugin(PluginManager pluginManager, File pluginDirectory) {
// Make the expanded plugin directory be the “fastpath” webapp in the
// embedded Jetty server.
jetty = AdminConsolePlugin.getJettyServer();
try {
webapp = jetty.addWebApplication("/" + pluginDirectory.getName(), pluginDirectory.getAbsolutePath());
// The embedded web server doesn’'t know how to compile JSPs. Therefore, we have
// to manually parse a generated web.xml file and add the entries as servlets
// to the webapp.
try {
ServletHandler servletHandler = webapp.getServletHandler();
// Make the reader non-validating so that it doesn’'t try to resolve external
// DTD’‘s. Trying to resolve external DTD’'s can break on some firewall configurations.
SAXReader saxReader = new SAXReader(false);
saxReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
Document doc = saxReader.read(new File(pluginDirectory, “WEB-INF” +
File.separator + “web.xml.generated”));
// Find all entries to discover name to URL mapping.
List names = doc.selectNodes("//servlet-mapping");
for (int i = 0; i < names.size(); i++) {
Element nameElement = (Element)names.get(i);
String name = nameElement.element(“servlet-name”).getTextTrim();
String url = nameElement.element(“url-pattern”).getTextTrim();
servletHandler.addServlet(name, url, (String)classMap.get(name));
}
}
catch (Exception e) {
Log.error(e);
}
}
catch (IOException ioe) {
Log.error(ioe);
}
try {
webapp.stop();
webapp.start();
}
catch (Exception e) {
Log.error(e);
}
}
public void destroyPlugin() {
try {
webapp.stop();
webapp.destroy();
}
catch (Exception e) {
Log.error(e);
}
webapp = null;
jetty = null;
}[/code]