Example usage for com.liferay.portal.kernel.servlet ServletContextPool keySet

List of usage examples for com.liferay.portal.kernel.servlet ServletContextPool keySet

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet ServletContextPool keySet.

Prototype

public static Set<String> keySet() 

Source Link

Usage

From source file:com.liferay.httpservice.internal.WebBundleDeployer.java

License:Open Source License

public void close() {
    Set<String> servletContextNames = ServletContextPool.keySet();

    for (String servletContextName : servletContextNames) {
        ServletContext servletContext = ServletContextPool.get(servletContextName);

        if (!(servletContext instanceof BundleServletContext)) {
            continue;
        }/*w  w  w  .j a  v a2s .  c  o m*/

        BundleServletContext bundleServletContext = (BundleServletContext) servletContext;

        Bundle bundle = bundleServletContext.getBundle();

        try {
            doStop(bundle, servletContextName);
        } catch (Exception e) {
            _log.error(e, e);
        }
    }

    _webExtenderServlet = null;
}

From source file:jorgediazest.util.model.ModelUtil.java

License:Open Source License

public static List<ClassLoader> getClassLoaders() {
    List<ClassLoader> classLoaders = new ArrayList<>();

    for (String servletContextName : ServletContextPool.keySet()) {
        try {/*from  w w  w.  ja  v a 2s . c  o  m*/
            ServletContext servletContext = ServletContextPool.get(servletContextName);

            ClassLoader classLoader = servletContext.getClassLoader();

            if (classLoader == null) {
                continue;
            }

            if (_log.isDebugEnabled()) {
                _log.debug("Adding " + classLoader + " for " + servletContextName);
            }

            classLoaders.add(classLoader);
        } catch (Exception e) {
            if (_log.isWarnEnabled()) {
                _log.warn("Error adding classLoader for " + servletContextName + ": " + e.getMessage(), e);
            }
        }
    }

    return classLoaders;
}