@Override public void beforeCommit(HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getResponseCookiesInternal(); if (cookies != null) { for (Map.Entry<String, Cookie> cookie : exchange.getResponseCookies().entrySet()) { cookie.getValue().setSecure(true); } } } }
@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 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 public void beforeCommit(HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getResponseCookiesInternal(); if (cookies != null) { for (Map.Entry<String, Cookie> cookie : exchange.getResponseCookies().entrySet()) { cookie.getValue().setSecure(true); } } } }
@Override public void beforeCommit(HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getResponseCookiesInternal(); if (cookies != null) { for (Map.Entry<String, Cookie> cookie : exchange.getResponseCookies().entrySet()) { cookie.getValue().setSecure(true); } } } }
@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 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); } } }
static public Cookie convertNinjaCookieToUndertowCookie(ninja.Cookie ninjaCookie) { Cookie undertowCookie = new CookieImpl(ninjaCookie.getName(), ninjaCookie.getValue()); undertowCookie.setMaxAge(ninjaCookie.getMaxAge()); if (ninjaCookie.getComment() != null) { undertowCookie.setComment(ninjaCookie.getComment()); } if (ninjaCookie.getDomain() != null) { undertowCookie.setDomain(ninjaCookie.getDomain()); } if (ninjaCookie.getPath() != null) { undertowCookie.setPath(ninjaCookie.getPath()); } undertowCookie.setSecure(ninjaCookie.isSecure()); undertowCookie.setHttpOnly(ninjaCookie.isHttpOnly()); // TODO: discard, version, and expires??? return undertowCookie; }