Package org.apache.http.cookie
Class CookiePathComparator
java.lang.Object
org.apache.http.cookie.CookiePathComparator
- All Implemented Interfaces:
Serializable,Comparator<Cookie>
public class CookiePathComparator extends Object implements Serializable, Comparator<Cookie>
This cookie comparator ensures that multiple cookies satisfying
a common criteria are ordered in the Cookie header such
that those with more specific Path attributes precede those with
less specific.
This comparator assumes that Path attributes of two cookies path-match a commmon request-URI. Otherwise, the result of the comparison is undefined.
- Author:
- Oleg Kalnichevski
- See Also:
- Serialized Form
-
Constructor Details
-
CookiePathComparator
public CookiePathComparator()
-
-
Method Details
-
compare
Description copied from interface:ComparatorCompares the two specified objects to determine their relative ordering. The ordering implied by the return value of this method for all possible pairs of(lhs, rhs)should form an equivalence relation. This means thatcompare(a,a)returns zero for alla- the sign of
compare(a,b)must be the opposite of the sign ofcompare(b,a)for all pairs of (a,b) - From
compare(a,b) > 0andcompare(b,c) > 0it must followcompare(a,c) > 0for all possible combinations of(a,b,c)
- Specified by:
comparein interfaceComparator<Cookie>- Parameters:
c1- anObject.c2- a secondObjectto compare withlhs.- Returns:
- an integer < 0 if
lhsis less thanrhs, 0 if they are equal, and > 0 iflhsis greater thanrhs.
-