/** * Get the requests' cookie by name * * @param name * The name of the cookie to be looked up * * @return A cookie, null if not found. * @since 1.3.0-beta4 */ public Cookie getCookie(String name) { Cookie[] cookies = getCookies(); if (cookies != null && cookies.length > 0) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(name)) { return cookies[i]; } } } return null; }
/** * Get the requests' cookie by name * * @param name * The name of the cookie to be looked up * * @return A cookie, null if not found. * @since 1.3.0-beta4 */ public Cookie getCookie(String name) { Cookie[] cookies = getCookies(); if (cookies != null && cookies.length > 0) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(name)) { return cookies[i]; } } } return null; }
/** * * * @return The client's navigator.cookieEnabled property. */ public boolean isCookiesEnabled() { if (!cookiesEnabled && RequestCycle.get() != null) { Cookie[] cookies = ((WebRequest)RequestCycle.get().getRequest()).getCookies(); cookiesEnabled = cookies != null ? cookies.length > 0 : false; } return cookiesEnabled; }
/** * * * @return The client's navigator.cookieEnabled property. */ public boolean isCookiesEnabled() { if (!cookiesEnabled && RequestCycle.get() != null) { Cookie[] cookies = ((WebRequest)RequestCycle.get().getRequest()).getCookies(); cookiesEnabled = cookies != null ? cookies.length > 0 : false; } return cookiesEnabled; }