private JettyServer server;
public void start(ExtensionPointRegistry extensionPointRegistry) {
// Register a Jetty Servlet host
ServletHostExtensionPoint servletHosts =
extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
if (servletHosts.getServletHosts().size() < 1) {
UtilityExtensionPoint utilities = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class);
final WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
// Allow privileged access to start MBeans. Requires MBeanPermission in security policy.
try {
server = AccessController.doPrivileged(new PrivilegedAction<JettyServer>() {
public JettyServer run() {
return new JettyServer(workScheduler);
}
});
servletHosts.addServletHost(server);
} catch (Exception e) {
logger.log(Level.WARNING, "Exception creating JettyServer", e);
}
}
}