Source:
public PushBuilder newPushBuilder() { if (!isPushSupported()) return null; HttpFields.Mutable fields = HttpFields.build(getHttpFields(), NOT_PUSHED_HEADERS); HttpField authField = getHttpFields().getField(HttpHeader.AUTHORIZATION); if (getUserPrincipal() != null && authField.getValue().startsWith("Basic")) fields.add(authField); String id; try { HttpSession session = getSession(); if (session != null) { session.getLastAccessedTime(); id = session.getId(); } else id = getRequestedSessionId(); } catch (IllegalStateException e) { id = getRequestedSessionId(); } Map<String,String> cookies = new HashMap<>(); Cookie[] existingCookies = getCookies(); if (existingCookies != null) { for (Cookie c: getCookies()) { cookies.put(c.getName(), c.getValue()); } } HttpFields responseFields = getResponse().getHttpFields(); for (HttpField field : responseFields) { HttpHeader header = field.getHeader(); if (header == null) continue; switch (header) { case SET_COOKIE: { HttpCookie cookie = ((SetCookieHttpField)field).getHttpCookie(); if (cookie.getMaxAge() > 0) cookies.put(cookie.getName(), cookie.getValue()); else cookies.remove(cookie.getName()); continue; } default: continue; } } if (!cookies.isEmpty()) { StringBuilder buff = new StringBuilder(); for (Map.Entry<String,String> entry : cookies.entrySet()) { if (buff.length() > 0) buff.append("; "); buff.append(entry.getKey()).append('=').append(entry.getValue()); } fields.add(new HttpField(HttpHeader.COOKIE, buff.toString())); } PushBuilder builder = new PushBuilderImpl(this, fields, getMethod(), getQueryString(), id); builder.addHeader("referer", getRequestURL().toString()); return builder; }

Target:
public PushBuilder newPushBuilder() { if (!isPushSupported()) return null; HttpFields.Mutable fields = HttpFields.build(getHttpFields(), NOT_PUSHED_HEADERS); HttpField authField = getHttpFields().getField(HttpHeader.AUTHORIZATION); if (getUserPrincipal() != null && authField.getValue().startsWith("Basic")) fields.add(authField); String id; try { HttpSession session = getSession(); if (session != null) { session.getLastAccessedTime(); id = session.getId(); } else id = getRequestedSessionId(); } catch (IllegalStateException e) { id = getRequestedSessionId(); } Map<String,String> cookies = new HashMap<>(); Cookie[] existingCookies = getCookies(); if (existingCookies != null) { for (Cookie c: getCookies()) { cookies.put(c.getName(), c.getValue()); } } HttpFields responseFields = getResponse().getHttpFields(); for (HttpField field : responseFields) { HttpHeader header = field.getHeader(); if (header == HttpHeader.SET_COOKIE) { HttpCookie cookie = ((SetCookieHttpField)field).getHttpCookie(); if (cookie.getMaxAge() > 0) cookies.put(cookie.getName(), cookie.getValue()); else cookies.remove(cookie.getName()); } } if (!cookies.isEmpty()) { StringBuilder buff = new StringBuilder(); for (Map.Entry<String,String> entry : cookies.entrySet()) { if (buff.length() > 0) buff.append("; "); buff.append(entry.getKey()).append('=').append(entry.getValue()); } fields.add(new HttpField(HttpHeader.COOKIE, buff.toString())); } PushBuilder builder = new PushBuilderImpl(this, fields, getMethod(), getQueryString(), id); builder.addHeader("referer", getRequestURL().toString()); return builder; }