org.springframework.http.ResponseCookie#getPath ( )源码实例Demo

下面列出了org.springframework.http.ResponseCookie#getPath ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected void applyCookies() {
	for (String name : getCookies().keySet()) {
		for (ResponseCookie httpCookie : getCookies().get(name)) {
			Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
			if (!httpCookie.getMaxAge().isNegative()) {
				cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.response.addCookie(cookie);
		}
	}
}
 
@Override
protected void applyCookies() {
	for (String name : getCookies().keySet()) {
		for (ResponseCookie httpCookie : getCookies().get(name)) {
			Cookie cookie = new CookieImpl(name, httpCookie.getValue());
			if (!httpCookie.getMaxAge().isNegative()) {
				cookie.setMaxAge((int) httpCookie.getMaxAge().getSeconds());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.exchange.getResponseCookies().putIfAbsent(name, cookie);
		}
	}
}
 
@Override
protected void applyCookies() {
	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());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.response.addCookie(cookie);
		}
	}
}
 
@Override
protected void applyCookies() {
	for (String name : getCookies().keySet()) {
		for (ResponseCookie httpCookie : getCookies().get(name)) {
			Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
			if (!httpCookie.getMaxAge().isNegative()) {
				cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.response.addCookie(cookie);
		}
	}
}
 
@Override
protected void applyCookies() {
	for (String name : getCookies().keySet()) {
		for (ResponseCookie httpCookie : getCookies().get(name)) {
			Cookie cookie = new CookieImpl(name, httpCookie.getValue());
			if (!httpCookie.getMaxAge().isNegative()) {
				cookie.setMaxAge((int) httpCookie.getMaxAge().getSeconds());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.exchange.getResponseCookies().putIfAbsent(name, cookie);
		}
	}
}
 
@Override
protected void applyCookies() {
	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());
			}
			if (httpCookie.getDomain() != null) {
				cookie.setDomain(httpCookie.getDomain());
			}
			if (httpCookie.getPath() != null) {
				cookie.setPath(httpCookie.getPath());
			}
			cookie.setSecure(httpCookie.isSecure());
			cookie.setHttpOnly(httpCookie.isHttpOnly());
			this.response.addCookie(cookie);
		}
	}
}
 
源代码7 项目: armeria   文件: ArmeriaServerHttpResponse.java
/**
 * Converts the specified {@link ResponseCookie} to Netty's {@link Cookie} interface.
 */
private static Cookie toArmeriaCookie(ResponseCookie resCookie) {
    final CookieBuilder builder = Cookie.builder(resCookie.getName(), resCookie.getValue());
    if (!resCookie.getMaxAge().isNegative()) {
        builder.maxAge(resCookie.getMaxAge().getSeconds());
    }
    if (resCookie.getDomain() != null) {
        builder.domain(resCookie.getDomain());
    }
    if (resCookie.getPath() != null) {
        builder.path(resCookie.getPath());
    }
    builder.secure(resCookie.isSecure());
    builder.httpOnly(resCookie.isHttpOnly());
    if (resCookie.getSameSite() != null) {
        builder.sameSite(resCookie.getSameSite());
    }
    return builder.build();
}