powered by Jive Software

Properly unbind WebAppContexts in Plugin destroy


#1

Hello Community,

I am struggling for a while now to get a plugin reload working with properly rebinding the WebAppContext.

Each time I reload, jetty won’t accept connections to the WebApp Context path anymore thus resulting in a 404 for the clients.

My initializePlugin contains the following:

componentManager = ComponentManagerFactory.getComponentManager();
try
{
    componentManager.addComponent(serviceName, this);
}
catch (Exception e) {}
PropertyEventDispatcher.addListener(this);
contexts = HttpBindManager.getInstance().getContexts();
context = new WebAppContext(contexts, developmentPath, PropertyConstants.WEB_APP_CONTEXT_PATH);
securityHandler = formAuth(...);

destroyPlugin:

PropertyEventDispatcher.removeListener(this);  try  {      componentManager.removeComponent(serviceName);      componentManager = null;  }  catch (Exception e) {}  if (contexts != null)      contexts.removeHandler(context);    if (context != null)      context.destroy();    if (securityHandler != null)      securityHandler.destroy();    context = null;  contexts = null;  securityHandler = null;

Is there anything else needed to destroy the WebApp Context?

Any helping clues would be much apprectiated

Regards,

Felix


#2

Changes related to this were applied to Openfire 4.1.5. Are you using that? The changes are tracked as OF-1326.

If memory serves, there now are addJettyHandler() and removeJettyHandler() methods that you can use for this.