Java Code Examples for io.undertow.server.handlers.Cookie#setMaxAge()
The following examples show how to use
io.undertow.server.handlers.Cookie#setMaxAge() .
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: UndertowServerHttpResponse.java From spring-analysis-note with MIT License | 6 votes |
@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 2
Source File: UndertowServerHttpResponse.java From java-technology-stack with MIT License | 6 votes |
@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: SessionCookieConfig.java From quarkus-http with Apache License 2.0 | 5 votes |
@Override public void setSessionId(final HttpServerExchange exchange, final String sessionId) { Cookie cookie = new CookieImpl(cookieName, sessionId) .setPath(path) .setDomain(domain) .setDiscard(discard) .setSecure(secure) .setHttpOnly(httpOnly) .setComment(comment); if (maxAge > 0) { cookie.setMaxAge(maxAge); } exchange.setResponseCookie(cookie); UndertowLogger.SESSION_LOGGER.tracef("Setting session cookie session id %s on %s", sessionId, exchange); }
Example 4
Source File: SessionCookieConfig.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void setSessionId(final HttpServerExchange exchange, final String sessionId) { Cookie cookie = new CookieImpl(cookieName, sessionId) .setPath(path) .setDomain(domain) .setDiscard(discard) .setSecure(secure) .setHttpOnly(httpOnly) .setComment(comment); if (maxAge > 0) { cookie.setMaxAge(maxAge); } exchange.setResponseCookie(cookie); UndertowLogger.SESSION_LOGGER.tracef("Setting session cookie session id %s on %s", sessionId, exchange); }