public List < HttpCookie > getCookies ( ) { List < HttpCookie > rt = new ArrayList < HttpCookie > ( ) ; lock . lock ( ) ; try { for ( List < HttpCookie > list : uriIndex . values ( ) ) { Iterator < HttpCookie > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { HttpCookie cookie = it . next ( ) ; if ( cookie . hasExpired ( ) ) { it . remove ( ) ; } else if ( ! rt . contains ( cookie ) ) { rt . add ( cookie ) ; } } } } finally { rt = Collections . unmodifiableList ( rt ) ; lock . unlock ( ) ; } return rt ; }
Get all cookies in cookie store except those have expired