b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
if (cookie.isHttpOnly()) b.append(";HttpOnly"); return b.toString();
sb.append(';').append(SECURE); if (newCookie.isHttpOnly()) { sb.append(';').append(HTTP_ONLY);
sb.append(';').append(SECURE); if (value.isHttpOnly()) { sb.append(';').append(HTTP_ONLY);
sb.append(';').append(SECURE); if (newCookie.isHttpOnly()) { sb.append(';').append(HTTP_ONLY);
if (cookie.isHttpOnly()) { buf.append(";HttpOnly");
if (cookie.isHttpOnly()) { sb.append(';').append("HttpOnly");
@Override public void addNewCookie(NewCookie cookie) { Cookie cook = new Cookie(cookie.getName(), cookie.getValue()); cook.setMaxAge(cookie.getMaxAge()); cook.setVersion(cookie.getVersion()); if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain()); if (cookie.getPath() != null) cook.setPath(cookie.getPath()); cook.setSecure(cookie.isSecure()); if (cookie.getComment() != null) cook.setComment(cookie.getComment()); if (cookie.isHttpOnly()) cook.setHttpOnly(true); this.response.addCookie(cook); } };
@Override public void addNewCookie(NewCookie cookie) { Cookie cook = new Cookie(cookie.getName(), cookie.getValue()); cook.setMaxAge(cookie.getMaxAge()); cook.setVersion(cookie.getVersion()); if (cookie.getDomain() != null) cook.setDomain(cookie.getDomain()); if (cookie.getPath() != null) cook.setPath(cookie.getPath()); cook.setSecure(cookie.isSecure()); if (cookie.getComment() != null) cook.setComment(cookie.getComment()); if (cookie.isHttpOnly()) cook.setHttpOnly(true); this.response.addCookie(cook); } };
@Test public void shouldPersistAsInRfcErrata() { final ClientSideState clientSideState = new ClientSideState(RFC_EDITION, RFC_TIME, RFC_IV_SOURCE, SIMPLE_SERIALIZATION, SIMPLE_DESERIALIZATION, ClientSideState.DEFAULT_TIMEOUT); final NewCookie cookie = clientSideState.persist("id", "/path", "a state string"); assertThat(cookie).isNotNull(); assertThat(cookie.getName()).isEqualTo("id"); assertThat(cookie.getValue()) .isEqualTo("pzSOjcNui9-HWS_Qk1Pwpg|MTM0NzI2NTk1NQ|dGlk|tL3lJPf2nUSFMN6dtVXJTw|uea1fgC67RmOxfpNz8gMbnPWfDA"); assertThat(cookie.getPath()).isEqualTo("/path"); assertThat(cookie.isHttpOnly()).isFalse(); assertThat(cookie.isSecure()).isTrue(); }
@Test public void shouldPersistAsInRfcErrata() { final ClientSideState clientSideState = new ClientSideState(RFC_EDITION, RFC_TIME, RFC_IV_SOURCE, SIMPLE_SERIALIZATION, SIMPLE_DESERIALIZATION, ClientSideState.DEFAULT_TIMEOUT); final NewCookie cookie = clientSideState.persist("id", "/path", "a state string"); assertThat(cookie).isNotNull(); assertThat(cookie.getName()).isEqualTo("id"); assertThat(cookie.getValue()) .isEqualTo("pzSOjcNui9-HWS_Qk1Pwpg|MTM0NzI2NTk1NQ|dGlk|tL3lJPf2nUSFMN6dtVXJTw|uea1fgC67RmOxfpNz8gMbnPWfDA"); assertThat(cookie.getPath()).isEqualTo("/path"); assertThat(cookie.isHttpOnly()).isFalse(); assertThat(cookie.isSecure()).isTrue(); }
if (cookie.isHttpOnly()) b.append(";HttpOnly"); return b.toString();
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
@Test public void shouldPersistAsInRfcErrata() { final ClientSideState clientSideState = new ClientSideState(RFC_EDITION, RFC_TIME, RFC_IV_SOURCE, SIMPLE_SERIALIZATION, SIMPLE_DESERIALIZATION, ClientSideState.DEFAULT_TIMEOUT); final NewCookie cookie = clientSideState.persist("id", "/path", "a state string"); assertThat(cookie).isNotNull(); assertThat(cookie.getName()).isEqualTo("id"); assertThat(cookie.getValue()) .isEqualTo("pzSOjcNui9-HWS_Qk1Pwpg|MTM0NzI2NTk1NQ|dGlk|tL3lJPf2nUSFMN6dtVXJTw|uea1fgC67RmOxfpNz8gMbnPWfDA"); assertThat(cookie.getPath()).isEqualTo("/path"); assertThat(cookie.isHttpOnly()).isFalse(); assertThat(cookie.isSecure()).isTrue(); }
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
b.append(";Secure"); if (cookie.isHttpOnly()) { b.append(";HttpOnly");
private void saveCookies(Exchange exchange, Client client, CookieHandler cookieHandler) { if (cookieHandler != null) { CookieStore cookieStore = cookieHandler.getCookieStore(exchange); for (NewCookie newCookie: client.getResponse().getCookies().values()) { HttpCookie cookie = new HttpCookie(newCookie.getName(), newCookie.getValue()); cookie.setComment(newCookie.getComment()); cookie.setDomain(newCookie.getDomain()); cookie.setHttpOnly(newCookie.isHttpOnly()); cookie.setMaxAge(newCookie.getMaxAge()); cookie.setPath(newCookie.getPath()); cookie.setSecure(newCookie.isSecure()); cookie.setVersion(newCookie.getVersion()); cookieStore.add(client.getCurrentURI(), cookie); } } }