Package com.sun.enterprise.deployment.web

Examples of com.sun.enterprise.deployment.web.SessionConfig


                runtimeSessionConfig.setSessionProperties(sessionProperties);
            }
            addWebProperty(sessionProperties, TIMEOUT_SECONDS, Integer.toString(timeoutSecs));
            if (cookieTrackingMode && urlTrackingMode) {
                SessionConfig sessionConfig = getSessionConfig();
                sessionConfig.addTrackingMode(COOKIE);
                sessionConfig.addTrackingMode(URL);
            } else if (!cookieTrackingMode && urlTrackingMode) {
                SessionConfig sessionConfig = getSessionConfig();
                sessionConfig.removeTrackingMode(COOKIE);
                sessionConfig.addTrackingMode(URL);
            } else if (cookieTrackingMode && !urlTrackingMode) {
                SessionConfig sessionConfig = getSessionConfig();
                sessionConfig.addTrackingMode(COOKIE);
                sessionConfig.removeTrackingMode(URL);
            } else {
                SessionConfig sessionConfig = getSessionConfig();
                sessionConfig.removeTrackingMode(COOKIE);
                sessionConfig.removeTrackingMode(URL);
                // turn off cookie and url, only ssl is left
                sessionConfig.addTrackingMode(SSL);
            }
        }
        return super.endElement(element);
    }
View Full Code Here


    public Object getDescriptor() {
        return null;
    }

    public Node writeDescriptor(Element root, WebBundleDescriptor webBundleDescriptor) {
        SessionConfig sessionConfig = webBundleDescriptor.getSessionConfig();
        com.sun.enterprise.deployment.runtime.web.SessionConfig runtimeSessionConfig =
                webBundleDescriptor.getSunDescriptor().getSessionConfig();
        Node scNode = null;
        if (sessionConfig != null || runtimeSessionConfig != null) {
            scNode = appendChild(root, RuntimeTagNames.SESSION_DESCRIPTOR);
        }

        if (runtimeSessionConfig != null) {
            // timeout-secs
            SessionProperties sessionProperties = runtimeSessionConfig.getSessionProperties();
            if (sessionProperties != null && sessionProperties.sizeWebProperty() > 0) {
                for (WebProperty prop : sessionProperties.getWebProperty()) {
                    String name = prop.getAttributeValue(WebProperty.NAME);
                    String value = prop.getAttributeValue(WebProperty.VALUE);
                    if (TIMEOUT_SECONDS.equals(name)) {
                        appendTextChild(scNode, RuntimeTagNames.TIMEOUT_SECS, value);
                        break;
                    }
                }
            }

            // invalidation-interval-secs, max-in-memory-sessions
            SessionManager sessionManager = runtimeSessionConfig.getSessionManager();
            if (sessionManager != null) {
                ManagerProperties managerProperties = sessionManager.getManagerProperties();
                if (managerProperties != null && managerProperties.sizeWebProperty() > 0) {
                    for (WebProperty prop : managerProperties.getWebProperty()) {
                        String name = prop.getAttributeValue(WebProperty.NAME);
                        String value = prop.getAttributeValue(WebProperty.VALUE);
                        if (name.equals(REAP_INTERVAL_SECONDS)) {
                            appendTextChild(scNode,
                                    RuntimeTagNames.INVALIDATION_INTERVAL_SECS, value);
                        } else if (name.equals(MAX_SESSIONS)) {
                            appendTextChild(scNode,
                                    RuntimeTagNames.MAX_IN_MEMORY_SESSIONS, value);
                        }
                    }
                }
            }
        }

        if (sessionConfig != null) {
            Set<SessionTrackingMode> trackingModes = sessionConfig.getTrackingModes();
            if (trackingModes.contains(SessionTrackingMode.COOKIE)) {
                appendTextChild(scNode, RuntimeTagNames.COOKIES_ENABLED, "true");
            }

            CookieConfig cookieConfig = sessionConfig.getCookieConfig();
            if (cookieConfig != null) {
                if (cookieConfig.getName() != null && cookieConfig.getName().length() > 0) {
                    appendTextChild(scNode, RuntimeTagNames.COOKIE_NAME, cookieConfig.getName());
                }
                if (cookieConfig.getPath() != null) {
View Full Code Here

    /**
     * Get and create a SessionConfigDescriptor if necessary.
     */
    private SessionConfig getSessionConfig() {
        WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor)getParentNode().getDescriptor();
        SessionConfig sessionConfig = webBundleDescriptor.getSessionConfig();
        if (sessionConfig == null) {
            sessionConfig = new SessionConfigDescriptor();
            webBundleDescriptor.setSessionConfig(sessionConfig);
        }

View Full Code Here

    /**
     * Get and create a CookieConfigDescriptor if necessary.
     */
    private CookieConfig getCookieConfig() {
        SessionConfig sessionConfig = getSessionConfig();
        CookieConfig cookieConfig = sessionConfig.getCookieConfig();
        if (cookieConfig == null) {
            cookieConfig = new CookieConfigDescriptor();
            sessionConfig.setCookieConfig(cookieConfig);
        }
        return cookieConfig;
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.web.SessionConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.