Example usage for javax.servlet SessionCookieConfig setName

List of usage examples for javax.servlet SessionCookieConfig setName

Introduction

In this page you can find the example usage for javax.servlet SessionCookieConfig setName.

Prototype

public void setName(String name);

Source Link

Document

Sets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.

Usage

From source file:org.cloudfoundry.identity.uaa.web.UaaSessionCookieConfig.java

@Override
public void setServletContext(ServletContext servletContext) {
    logger.debug("Configuring session cookie.");

    try {/* w  ww  .j  a  v  a  2s  .c om*/
        SessionCookieConfig config = servletContext.getSessionCookieConfig();
        if (hasText(getComment())) {
            logger.debug(String.format("Configuring session cookie - Comment: %s", getComment()));
            config.setComment(getComment());
        }
        if (hasText(getDomain())) {
            logger.debug(String.format("Configuring session cookie - Domain: %s", getDomain()));
            config.setDomain(getDomain());
        }
        if (getMaxAge() > Integer.MIN_VALUE) {
            logger.debug(String.format("Configuring session cookie - MaxAge: %s", getMaxAge()));
            config.setMaxAge(getMaxAge());
        }
        if (getPath() != null) {
            logger.debug(String.format("Configuring session cookie - Path: %s", getPath()));
            config.setPath(getPath());
        }
        logger.debug(String.format("Configuring session cookie - HttpOnly: %s", isHttpOnly()));
        config.setHttpOnly(isHttpOnly());
        logger.debug(String.format("Configuring session cookie - Secure: %s", isSecure()));
        config.setSecure(isSecure());
        if (hasText(getName())) {
            logger.debug(String.format("Configuring session cookie - Name: %s", getName()));
            config.setName(getName());
        }
    } catch (Exception e) {
        logger.error("Ignoring session cookie config - unable to configure UAA session cookie", e);
    }
}