Search in sources :

Example 1 with SessionManager

use of org.glassfish.web.deployment.runtime.SessionManager in project Payara by payara.

the class DynamicWebServletRegistrationImpl method configureSessionSettings.

/**
 * Create and configure the session manager for this web application
 * according to the persistence type specified.
 *
 * Also configure the other aspects of session management for this
 * web application according to the values specified in the session-config
 * element of sun-web.xml (and whether app is distributable)
 */
protected void configureSessionSettings(WebBundleDescriptor wbd, WebModuleConfig wmInfo) {
    SessionConfig cfg = null;
    SessionManager smBean = null;
    SessionProperties sessionPropsBean = null;
    CookieProperties cookieBean = null;
    if (iasBean != null) {
        cfg = iasBean.getSessionConfig();
        if (cfg != null) {
            smBean = cfg.getSessionManager();
            sessionPropsBean = cfg.getSessionProperties();
            cookieBean = cfg.getCookieProperties();
        }
    }
    configureSessionManager(smBean, wbd, wmInfo);
    configureSession(sessionPropsBean, wbd);
    configureCookieProperties(cookieBean);
}
Also used : CookieProperties(org.glassfish.web.deployment.runtime.CookieProperties) SessionProperties(org.glassfish.web.deployment.runtime.SessionProperties) SessionManager(org.glassfish.web.deployment.runtime.SessionManager) SessionConfig(org.glassfish.web.deployment.runtime.SessionConfig)

Example 2 with SessionManager

use of org.glassfish.web.deployment.runtime.SessionManager in project Payara by payara.

the class WebApplication method stopCoherenceWeb.

private void stopCoherenceWeb() {
    if (wmInfo.getDescriptor() != null && wmInfo.getDescriptor().getSunDescriptor() != null) {
        SunWebAppImpl sunWebApp = (SunWebAppImpl) wmInfo.getDescriptor().getSunDescriptor();
        if (sunWebApp.getSessionConfig() != null && sunWebApp.getSessionConfig().getSessionManager() != null) {
            SessionManager sessionManager = sunWebApp.getSessionConfig().getSessionManager();
            String persistenceType = sessionManager.getAttributeValue(SessionManager.PERSISTENCE_TYPE);
            if (PersistenceType.COHERENCE_WEB.getType().equals(persistenceType)) {
                ClassLoader cloader = wmInfo.getAppClassLoader();
                try {
                    Class<?> cacheFactoryClass = cloader.loadClass("com.tangosol.net.CacheFactory");
                    if (cacheFactoryClass != null) {
                        Method shutdownMethod = cacheFactoryClass.getMethod("shutdown");
                        if (shutdownMethod != null) {
                            shutdownMethod.invoke(null);
                        }
                    }
                } catch (Exception ex) {
                    if (logger.isLoggable(Level.WARNING)) {
                        String msg = rb.getString(LogFacade.EXCEPTION_SHUTDOWN_COHERENCE_WEB);
                        msg = MessageFormat.format(msg, wmInfo.getDescriptor().getName());
                        logger.log(Level.WARNING, msg, ex);
                    }
                }
            }
        }
    }
}
Also used : SunWebAppImpl(org.glassfish.web.deployment.runtime.SunWebAppImpl) SessionManager(org.glassfish.web.deployment.runtime.SessionManager) String(java.lang.String) Method(java.lang.reflect.Method)

Aggregations

SessionManager (org.glassfish.web.deployment.runtime.SessionManager)2 String (java.lang.String)1 Method (java.lang.reflect.Method)1 CookieProperties (org.glassfish.web.deployment.runtime.CookieProperties)1 SessionConfig (org.glassfish.web.deployment.runtime.SessionConfig)1 SessionProperties (org.glassfish.web.deployment.runtime.SessionProperties)1 SunWebAppImpl (org.glassfish.web.deployment.runtime.SunWebAppImpl)1