org.springframework.web.server.session

Class CookieWebSessionIdResolver

  • java.lang.Object
    • org.springframework.web.server.session.CookieWebSessionIdResolver
    • Constructor Detail

      • CookieWebSessionIdResolver

        public CookieWebSessionIdResolver()
    • Method Detail

      • setCookieName

        public void setCookieName(java.lang.String cookieName)
        Set the name of the cookie to use for the session id.

        By default set to "SESSION".

        Parameters:
        cookieName - the cookie name
      • getCookieName

        public java.lang.String getCookieName()
        Return the configured cookie name.
      • setCookieMaxAge

        public void setCookieMaxAge(java.time.Duration maxAge)
        Set the value for the "Max-Age" attribute of the cookie that holds the session id. For the range of values see ResponseCookie.getMaxAge().

        By default set to -1.

        Parameters:
        maxAge - the maxAge duration value
      • getCookieMaxAge

        public java.time.Duration getCookieMaxAge()
        Return the configured "Max-Age" attribute value for the session cookie.
      • addCookieInitializer

        public void addCookieInitializer(java.util.function.Consumer<ResponseCookie.ResponseCookieBuilder> initializer)
        Add a Consumer for a ResponseCookieBuilder that will be invoked for each cookie being built, just before the call to build().
        Parameters:
        initializer - consumer for a cookie builder
        Since:
        5.1
      • resolveSessionIds

        public java.util.List<java.lang.String> resolveSessionIds(ServerWebExchange exchange)
        Description copied from interface: WebSessionIdResolver
        Resolve the session id's associated with the request.
        Specified by:
        resolveSessionIds in interface WebSessionIdResolver
        Parameters:
        exchange - the current exchange
        Returns:
        the session id's or an empty list