@Test public void shouldApplyCookies() { response.addCookie( ResponseCookie.from("cookie1", "value1") .domain("domain1") .path("path1") .maxAge(1) .httpOnly(true) .secure(true) .build() ); response.addCookie( ResponseCookie.from("cookie1", "value2") .domain("domain1") .path("path1") .maxAge(1) .httpOnly(true) .secure(true) .build() ); response.addCookie( ResponseCookie.from("cookie2", "value3") .domain("domain2") .path("path2") .maxAge(2) .httpOnly(false) .secure(false) .build() ); response.applyCookies(); ArgumentCaptor<Cookie> cookieCaptor = ArgumentCaptor.forClass(Cookie.class); verify(mockRoutingContext, times(3)).addCookie(cookieCaptor.capture()); assertThat(cookieCaptor.getAllValues().get(0)).isEqualToComparingFieldByField( Cookie.cookie("cookie1", "value1") .setDomain("domain1") .setPath("path1") .setMaxAge(1) .setHttpOnly(true) .setSecure(true) ); assertThat(cookieCaptor.getAllValues().get(1)).isEqualToComparingFieldByField( Cookie.cookie("cookie1", "value2") .setDomain("domain1") .setPath("path1") .setMaxAge(1) .setHttpOnly(true) .setSecure(true) ); assertThat(cookieCaptor.getAllValues().get(2)).isEqualToComparingFieldByField( Cookie.cookie("cookie2", "value3") .setDomain("domain2") .setPath("path2") .setMaxAge(2) .setHttpOnly(false) .setSecure(false) ); }
@Override protected void applyCookies() { getCookies() .values() .stream() .flatMap(List::stream) .map(CookieConverter::toCookie) .forEach(context::addCookie); }
VertxServerHttpResponse extends AbstractServerHttpResponse implements ZeroCopyHttpOutputMessage { @Override protected void applyCookies() { getCookies() .values() .stream() .flatMap(List::stream) .map(CookieConverter::toCookie) .forEach(context::addCookie); } }
VertxServerHttpResponse extends AbstractServerHttpResponse implements ZeroCopyHttpOutputMessage { @Override protected void applyCookies() { getCookies() .values() .stream() .flatMap(List::stream) .map(CookieConverter::toCookie) .forEach(context::addCookie); } VertxServerHttpResponse(RoutingContext context, BufferConverter bufferConverter); }
VertxServerHttpResponse extends AbstractServerHttpResponse implements ZeroCopyHttpOutputMessage { @Override protected void applyCookies() { getCookies() .values() .stream() .flatMap(List::stream) .map(CookieConverter::toCookie) .forEach(context::addCookie); } VertxServerHttpResponse(RoutingContext context, BufferConverter bufferConverter); @SuppressWarnings("unchecked") @Override T getNativeResponse(); @Override Mono<Void> writeWith(Path file, long position, long count); }
VertxServerHttpResponse extends AbstractServerHttpResponse implements ZeroCopyHttpOutputMessage { @Override protected void applyCookies() { getCookies() .values() .stream() .flatMap(List::stream) .map(CookieConverter::toCookie) .forEach(context::addCookie); } VertxServerHttpResponse(RoutingContext context, BufferConverter bufferConverter); @SuppressWarnings("unchecked") @Override T getNativeResponse(); @Override Mono<Void> writeWith(Path file, long position, long count);  }