/** * Removes the specified cookie. * If disabled, this does nothing. * @param cookie the cookie to remove */ public synchronized void removeCookie(final Cookie cookie) { if (!isCookiesEnabled()) { return; } cookies_.remove(cookie); }
/** * Removes all cookies. * If disabled, this does nothing. */ public synchronized void clearCookies() { if (!isCookiesEnabled()) { return; } cookies_.clear(); } }
/** * Removes the specified cookie. * If disabled, this does nothing. * @param cookie the cookie to remove */ public synchronized void removeCookie(final Cookie cookie) { if (!isCookiesEnabled()) { return; } cookies_.remove(cookie); }
/** * Removes all cookies. * If disabled, this does nothing. */ public synchronized void clearCookies() { if (!isCookiesEnabled()) { return; } cookies_.clear(); } }
/** * Returns the currently configured cookies, in an unmodifiable set. * If disabled, this returns an empty set. * @return the currently configured cookies, in an unmodifiable set */ public synchronized Set<Cookie> getCookies() { if (!isCookiesEnabled()) { return Collections.<Cookie>emptySet(); } final Set<Cookie> copy = new LinkedHashSet<>(); copy.addAll(cookies_); return Collections.unmodifiableSet(copy); }
/** * Returns the currently configured cookies, in an unmodifiable set. * If disabled, this returns an empty set. * @return the currently configured cookies, in an unmodifiable set */ public synchronized Set<Cookie> getCookies() { if (!isCookiesEnabled()) { return Collections.<Cookie>emptySet(); } final Set<Cookie> copy = new LinkedHashSet<>(); copy.addAll(cookies_); return Collections.unmodifiableSet(copy); }
/** * Returns the currently configured cookie with the specified name, or {@code null} if one does not exist. * If disabled, this returns null. * @param name the name of the cookie to return * @return the currently configured cookie with the specified name, or {@code null} if one does not exist */ public synchronized Cookie getCookie(final String name) { if (!isCookiesEnabled()) { return null; } for (Cookie cookie : cookies_) { if (StringUtils.equals(cookie.getName(), name)) { return cookie; } } return null; }
/** * Returns the currently configured cookie with the specified name, or {@code null} if one does not exist. * If disabled, this returns null. * @param name the name of the cookie to return * @return the currently configured cookie with the specified name, or {@code null} if one does not exist */ public synchronized Cookie getCookie(final String name) { if (!isCookiesEnabled()) { return null; } for (Cookie cookie : cookies_) { if (StringUtils.equals(cookie.getName(), name)) { return cookie; } } return null; }
/** * Adds the specified cookie. * If disabled, this does nothing. * @param cookie the cookie to add */ public synchronized void addCookie(final Cookie cookie) { if (!isCookiesEnabled()) { return; } cookies_.remove(cookie); // don't add expired cookie if (cookie.getExpires() == null || cookie.getExpires().after(new Date())) { cookies_.add(cookie); } }
/** * Adds the specified cookie. * If disabled, this does nothing. * @param cookie the cookie to add */ public synchronized void addCookie(final Cookie cookie) { if (!isCookiesEnabled()) { return; } cookies_.remove(cookie); // don't add expired cookie if (cookie.getExpires() == null || cookie.getExpires().after(new Date())) { cookies_.add(cookie); } }
/** * Clears all cookies that have expired before supplied date. * If disabled, this returns false. * @param date the date to use for comparison when clearing expired cookies * @return whether any cookies were found expired, and were cleared */ public synchronized boolean clearExpired(final Date date) { if (!isCookiesEnabled()) { return false; } if (date == null) { return false; } boolean foundExpired = false; for (final Iterator<Cookie> iter = cookies_.iterator(); iter.hasNext();) { final Cookie cookie = iter.next(); if (cookie.getExpires() != null && date.after(cookie.getExpires())) { iter.remove(); foundExpired = true; } } return foundExpired; }
/** * Clears all cookies that have expired before supplied date. * If disabled, this returns false. * @param date the date to use for comparison when clearing expired cookies * @return whether any cookies were found expired, and were cleared */ public synchronized boolean clearExpired(final Date date) { if (!isCookiesEnabled()) { return false; } if (date == null) { return false; } boolean foundExpired = false; for (final Iterator<Cookie> iter = cookies_.iterator(); iter.hasNext();) { final Cookie cookie = iter.next(); if (cookie.getExpires() != null && date.after(cookie.getExpires())) { iter.remove(); foundExpired = true; } } return foundExpired; }
/** * Returns the property "cookieEnabled". * @return the property "cookieEnabled" */ public boolean jsxGet_cookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Returns the property "cookieEnabled". * @return the property "cookieEnabled" */ public boolean jsxGet_cookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Returns the property "cookieEnabled". * @return the property "cookieEnabled" */ public boolean jsxGet_cookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Returns the {@code cookieEnabled} property. * @return the {@code cookieEnabled} property */ @JsxGetter public boolean isCookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Returns the {@code cookieEnabled} property. * @return the {@code cookieEnabled} property */ @JsxGetter public boolean isCookieEnabled() { return getWindow().getWebWindow().getWebClient().getCookieManager().isCookiesEnabled(); }
/** * Adds a cookie, as long as cookies are enabled. * @see <a href="http://msdn.microsoft.com/en-us/library/ms533693.aspx">MSDN documentation</a> * @param newCookie in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure] */ public void jsxSet_cookie(final String newCookie) { final CookieManager cookieManager = getHtmlPage().getWebClient().getCookieManager(); if (cookieManager.isCookiesEnabled()) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); url = replaceForCookieIfNecessary(url); final Cookie cookie = buildCookie(newCookie, url); cookieManager.addCookie(cookie); LOG.debug("Added cookie: " + cookie); } else { LOG.debug("Skipped adding cookie: " + newCookie); } }
/** * Adds a cookie, as long as cookies are enabled. * @see <a href="http://msdn.microsoft.com/en-us/library/ms533693.aspx">MSDN documentation</a> * @param newCookie in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure] */ public void jsxSet_cookie(final String newCookie) { final CookieManager cookieManager = getHtmlPage().getWebClient().getCookieManager(); if (cookieManager.isCookiesEnabled()) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); url = replaceForCookieIfNecessary(url); final Cookie cookie = buildCookie(newCookie, url); cookieManager.addCookie(cookie); LOG.debug("Added cookie: " + cookie); } else { LOG.debug("Skipped adding cookie: " + newCookie); } }
/** * Adds a cookie, as long as cookies are enabled. * @see <a href="http://msdn.microsoft.com/en-us/library/ms533693.aspx">MSDN documentation</a> * @param newCookie in the format "name=value[;expires=date][;domain=domainname][;path=path][;secure] */ public void jsxSet_cookie(final String newCookie) { final CookieManager cookieManager = getHtmlPage().getWebClient().getCookieManager(); if (cookieManager.isCookiesEnabled()) { URL url = getHtmlPage().getWebResponse().getRequestSettings().getUrl(); url = replaceForCookieIfNecessary(url); final Cookie cookie = buildCookie(newCookie, url); cookieManager.addCookie(cookie); LOG.debug("Added cookie: " + cookie); } else { LOG.debug("Skipped adding cookie: " + newCookie); } }