Java Code Examples for org.springframework.http.ResponseCookie#getPath()

The following examples show how to use org.springframework.http.ResponseCookie#getPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactorServerHttpResponse.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 2
Source File: UndertowServerHttpResponse.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 3
Source File: ServletServerHttpResponse.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 4
Source File: ReactorServerHttpResponse.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 5
Source File: UndertowServerHttpResponse.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 6
Source File: ServletServerHttpResponse.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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);
		}
	}
}
 
Example 7
Source File: ArmeriaServerHttpResponse.java    From armeria with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
}