Search in sources :

Example 1 with HttpSenderListener

use of org.zaproxy.zap.network.HttpSenderListener in project zaproxy by zaproxy.

the class ExtensionLoader method unhook.

private void unhook(Extension extension) {
    ExtensionHook hook = extensionHooks.remove(extension);
    if (hook == null) {
        logger.error("ExtensionHook not found for: " + extension.getClass().getCanonicalName());
        return;
    }
    unloadOptions(hook);
    unhookProxies(hook);
    removeSiteMapListener(hook);
    for (ContextDataFactory contextDataFactory : hook.getContextDataFactories()) {
        try {
            model.removeContextDataFactory(contextDataFactory);
        } catch (Exception e) {
            logger.error("Error while removing a ContextDataFactory from " + extension.getClass().getCanonicalName(), e);
        }
    }
    for (ApiImplementor apiImplementor : hook.getApiImplementors()) {
        try {
            API.getInstance().removeApiImplementor(apiImplementor);
        } catch (Exception e) {
            logger.error("Error while removing an ApiImplementor from " + extension.getClass().getCanonicalName(), e);
        }
    }
    for (HttpSenderListener httpSenderListener : hook.getHttpSenderListeners()) {
        try {
            HttpSender.removeListener(httpSenderListener);
        } catch (Exception e) {
            logger.error("Error while removing an HttpSenderListener from " + extension.getClass().getCanonicalName(), e);
        }
    }
    for (Class<? extends Variant> variant : hook.getVariants()) {
        try {
            model.getVariantFactory().removeVariant(variant);
        } catch (Exception e) {
            logger.error("Error while removing a Variant from " + extension.getClass().getCanonicalName(), e);
        }
    }
    removeViewInEDT(extension, hook);
}
Also used : ContextDataFactory(org.zaproxy.zap.model.ContextDataFactory) HttpSenderListener(org.zaproxy.zap.network.HttpSenderListener) ApiImplementor(org.zaproxy.zap.extension.api.ApiImplementor) InvocationTargetException(java.lang.reflect.InvocationTargetException) DatabaseException(org.parosproxy.paros.db.DatabaseException) DatabaseUnsupportedException(org.parosproxy.paros.db.DatabaseUnsupportedException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DatabaseException (org.parosproxy.paros.db.DatabaseException)1 DatabaseUnsupportedException (org.parosproxy.paros.db.DatabaseUnsupportedException)1 ApiImplementor (org.zaproxy.zap.extension.api.ApiImplementor)1 ContextDataFactory (org.zaproxy.zap.model.ContextDataFactory)1 HttpSenderListener (org.zaproxy.zap.network.HttpSenderListener)1