Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static class CookiePathComparator implements Comparator<HttpCookie> {
- public int compare(HttpCookie c1, HttpCookie c2) {
- if (c1 == c2) return 0;
- if (c1 == null) return -1;
- if (c2 == null) return 1;
- // path rule only applies to the cookies with same name
- if (!c1.getName().equals(c2.getName())) return 0;
- // those with more specific Path attributes precede those with less specific
- if (c1.getPath().startsWith(c2.getPath()))
- return -1;
- else if (c2.getPath().startsWith(c1.getPath()))
- return 1;
- else
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement