/** * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies. * If the given cookie has already expired it will not be added, but existing * values will still be removed. * * @param cookie the {@link Cookie cookie} to be added * * @see #addCookies(Cookie[]) * */ public synchronized void addCookie(Cookie cookie) { LOG.trace("enter HttpState.addCookie(Cookie)"); if (cookie != null) { // first remove any old cookie that is equivalent for (Iterator it = cookies.iterator(); it.hasNext();) { Cookie tmp = (Cookie) it.next(); if (cookie.equals(tmp)) { it.remove(); break; } } if (!cookie.isExpired()) { cookies.add(cookie); } } }
/** * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies. * If the given cookie has already expired it will not be added, but existing * values will still be removed. * * @param cookie the {@link Cookie cookie} to be added * * @see #addCookies(Cookie[]) * */ public synchronized void addCookie(Cookie cookie) { LOG.trace("enter HttpState.addCookie(Cookie)"); if (cookie != null) { // first remove any old cookie that is equivalent for (Iterator it = cookies.iterator(); it.hasNext();) { Cookie tmp = (Cookie) it.next(); if (cookie.equals(tmp)) { it.remove(); break; } } if (!cookie.isExpired()) { cookies.add(cookie); } } }
/** * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies. * If the given cookie has already expired it will not be added, but existing * values will still be removed. * * @param cookie the {@link Cookie cookie} to be added * * @see #addCookies(Cookie[]) * */ public synchronized void addCookie(Cookie cookie) { LOG.trace("enter HttpState.addCookie(Cookie)"); if (cookie != null) { // first remove any old cookie that is equivalent for (Iterator it = cookies.iterator(); it.hasNext();) { Cookie tmp = (Cookie) it.next(); if (cookie.equals(tmp)) { it.remove(); break; } } if (!cookie.isExpired()) { cookies.add(cookie); } } }
/** * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies. * If the given cookie has already expired it will not be added, but existing * values will still be removed. * * @param cookie the {@link Cookie cookie} to be added * * @see #addCookies(Cookie[]) * */ public synchronized void addCookie(Cookie cookie) { LOG.trace("enter HttpState.addCookie(Cookie)"); if (cookie != null) { // first remove any old cookie that is equivalent for (Iterator it = cookies.iterator(); it.hasNext();) { Cookie tmp = (Cookie) it.next(); if (cookie.equals(tmp)) { it.remove(); break; } } if (!cookie.isExpired()) { cookies.add(cookie); } } }
/** * Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies. * If the given cookie has already expired it will not be added, but existing * values will still be removed. * * @param cookie the {@link Cookie cookie} to be added * * @see #addCookies(Cookie[]) * */ public synchronized void addCookie(Cookie cookie) { LOG.trace("enter HttpState.addCookie(Cookie)"); if (cookie != null) { // first remove any old cookie that is equivalent for (Iterator it = cookies.iterator(); it.hasNext();) { Cookie tmp = (Cookie) it.next(); if (cookie.equals(tmp)) { it.remove(); break; } } if (!cookie.isExpired()) { cookies.add(cookie); } } }