001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import javax.servlet.http.Cookie;
018    
019    /**
020     * @author Shuyang Zhou
021     */
022    public class CookieUtil {
023    
024            public static String toString(Cookie cookie) {
025                    StringBundler sb = new StringBundler(17);
026    
027                    sb.append("{comment=");
028                    sb.append(cookie.getComment());
029                    sb.append(", domain=");
030                    sb.append(cookie.getDomain());
031                    sb.append(", maxAge=");
032                    sb.append(cookie.getMaxAge());
033                    sb.append(", name=");
034                    sb.append(cookie.getName());
035                    sb.append(", path=");
036                    sb.append(cookie.getPath());
037                    sb.append(", secure=");
038                    sb.append(cookie.getSecure());
039                    sb.append(", value=");
040                    sb.append(cookie.getValue());
041                    sb.append(", version=");
042                    sb.append(cookie.getVersion());
043                    sb.append("}");
044    
045                    return sb.toString();
046            }
047    
048    }