public static String [ ] getCookieValues ( Cookie [ ] cookies , String cookieName ) { if ( cookies == null ) { return null ; } Vector < String > retValues = new Vector < String > ( ) ; for ( int i = 0 ; i < cookies . length ; ++ i ) { if ( cookieName . equalsIgnoreCase ( cookies [ i ] . getName ( ) ) ) { retValues . add ( cookies [ i ] . getValue ( ) ) ; } } if ( retValues . size ( ) > 0 ) { return retValues . toArray ( new String [ retValues . size ( ) ] ) ; } else { return null ; } }
Retrieve the value of the all instances of the specified Cookie name from the array of Cookies . Note name matching ignores case .