Example usage for org.springframework.http ResponseCookie getDomain

List of usage examples for org.springframework.http ResponseCookie getDomain

Introduction

In this page you can find the example usage for org.springframework.http ResponseCookie getDomain.

Prototype

@Nullable
public String getDomain() 

Source Link

Document

Return the cookie "Domain" attribute, or null if not set.

Usage

From source file:org.springframework.http.server.reactive.ServletServerHttpResponse.java

@Override
protected void writeCookies() {
    for (String name : getCookies().keySet()) {
        for (ResponseCookie httpCookie : getCookies().get(name)) {
            Cookie cookie = new Cookie(name, httpCookie.getValue());
            if (!httpCookie.getMaxAge().isNegative()) {
                cookie.setMaxAge((int) httpCookie.getMaxAge().getSeconds());
            }/*from w w  w.  j  a v a2  s.c  o  m*/
            httpCookie.getDomain().ifPresent(cookie::setDomain);
            httpCookie.getPath().ifPresent(cookie::setPath);
            cookie.setSecure(httpCookie.isSecure());
            cookie.setHttpOnly(httpCookie.isHttpOnly());
            this.response.addCookie(cookie);
        }
    }
}