equal
deleted
inserted
replaced
52 // it won't be cleared in domainIndex & uriIndex. Double-check the |
52 // it won't be cleared in domainIndex & uriIndex. Double-check the |
53 // presence of cookie when retrieve one form index store. |
53 // presence of cookie when retrieve one form index store. |
54 private Map<String, List<HttpCookie>> domainIndex = null; |
54 private Map<String, List<HttpCookie>> domainIndex = null; |
55 private Map<URI, List<HttpCookie>> uriIndex = null; |
55 private Map<URI, List<HttpCookie>> uriIndex = null; |
56 |
56 |
57 // use ReentrantLock instead of syncronized for scalability |
57 // use ReentrantLock instead of synchronized for scalability |
58 private ReentrantLock lock = null; |
58 private ReentrantLock lock = null; |
59 |
59 |
60 |
60 |
61 /** |
61 /** |
62 * The default ctor |
62 * The default ctor |
258 } |
258 } |
259 |
259 |
260 int domainLength = domain.length(); |
260 int domainLength = domain.length(); |
261 int lengthDiff = host.length() - domainLength; |
261 int lengthDiff = host.length() - domainLength; |
262 if (lengthDiff == 0) { |
262 if (lengthDiff == 0) { |
263 // if the host name and the domain name are just string-compare euqal |
263 // if the host name and the domain name are just string-compare equal |
264 return host.equalsIgnoreCase(domain); |
264 return host.equalsIgnoreCase(domain); |
265 } else if (lengthDiff > 0) { |
265 } else if (lengthDiff > 0) { |
266 // need to check H & D component |
266 // need to check H & D component |
267 String H = host.substring(0, lengthDiff); |
267 String H = host.substring(0, lengthDiff); |
268 String D = host.substring(lengthDiff); |
268 String D = host.substring(lengthDiff); |
299 } |
299 } |
300 } else { |
300 } else { |
301 toRemove.add(c); |
301 toRemove.add(c); |
302 } |
302 } |
303 } else { |
303 } else { |
304 // the cookie has beed removed from main store, |
304 // the cookie has been removed from main store, |
305 // so also remove it from domain indexed store |
305 // so also remove it from domain indexed store |
306 toRemove.add(c); |
306 toRemove.add(c); |
307 } |
307 } |
308 } |
308 } |
309 } |
309 } |
343 } else { |
343 } else { |
344 it.remove(); |
344 it.remove(); |
345 cookieJar.remove(ck); |
345 cookieJar.remove(ck); |
346 } |
346 } |
347 } else { |
347 } else { |
348 // the cookie has beed removed from main store, |
348 // the cookie has been removed from main store, |
349 // so also remove it from domain indexed store |
349 // so also remove it from domain indexed store |
350 it.remove(); |
350 it.remove(); |
351 } |
351 } |
352 } |
352 } |
353 } // end of indexedCookies != null |
353 } // end of indexedCookies != null |