Java 类org.apache.http.cookie.CookiePathComparator 实例源码

项目:purecloud-iot    文件:RFC2109Spec.java   
@Override
public List<Header> formatCookies(final List<Cookie> cookies) {
    Args.notEmpty(cookies, "List of cookies");
    List<Cookie> cookieList;
    if (cookies.size() > 1) {
        // Create a mutable copy and sort the copy.
        cookieList = new ArrayList<Cookie>(cookies);
        Collections.sort(cookieList, CookiePathComparator.INSTANCE);
    } else {
        cookieList = cookies;
    }
    if (this.oneHeader) {
        return doFormatOneHeader(cookieList);
    } else {
        return doFormatManyHeaders(cookieList);
    }
}