• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/Cookie.java $
3  * $Revision: 578403 $
4  * $Date: 2007-09-22 03:56:04 -0700 (Sat, 22 Sep 2007) $
5  *
6  * ====================================================================
7  * Licensed to the Apache Software Foundation (ASF) under one
8  * or more contributor license agreements.  See the NOTICE file
9  * distributed with this work for additional information
10  * regarding copyright ownership.  The ASF licenses this file
11  * to you under the Apache License, Version 2.0 (the
12  * "License"); you may not use this file except in compliance
13  * with the License.  You may obtain a copy of the License at
14  *
15  *   http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing,
18  * software distributed under the License is distributed on an
19  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20  * KIND, either express or implied.  See the License for the
21  * specific language governing permissions and limitations
22  * under the License.
23  * ====================================================================
24  *
25  * This software consists of voluntary contributions made by many
26  * individuals on behalf of the Apache Software Foundation.  For more
27  * information on the Apache Software Foundation, please see
28  * <http://www.apache.org/>.
29  *
30  */
31 
32 package org.apache.http.cookie;
33 
34 import java.util.Date;
35 
36 /**
37  * HTTP "magic-cookie" represents a piece of state information
38  * that the HTTP agent and the target server can exchange to maintain
39  * a session.
40  *
41  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
42  *
43  * @since 4.0
44  *
45  * @deprecated Please use {@link java.net.URL#openConnection} instead.
46  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
47  *     for further details.
48  */
49 @Deprecated
50 public interface Cookie {
51 
52     /**
53      * Returns the name.
54      *
55      * @return String name The name
56      */
getName()57     String getName();
58 
59     /**
60      * Returns the value.
61      *
62      * @return String value The current value.
63      */
getValue()64     String getValue();
65 
66     /**
67      * Returns the comment describing the purpose of this cookie, or
68      * <tt>null</tt> if no such comment has been defined.
69      *
70      * @return comment
71      */
getComment()72     String getComment();
73 
74     /**
75      * If a user agent (web browser) presents this cookie to a user, the
76      * cookie's purpose will be described by the information at this URL.
77      */
getCommentURL()78     String getCommentURL();
79 
80     /**
81      * Returns the expiration {@link Date} of the cookie, or <tt>null</tt>
82      * if none exists.
83      * <p><strong>Note:</strong> the object returned by this method is
84      * considered immutable. Changing it (e.g. using setTime()) could result
85      * in undefined behaviour. Do so at your peril. </p>
86      * @return Expiration {@link Date}, or <tt>null</tt>.
87      */
getExpiryDate()88     Date getExpiryDate();
89 
90     /**
91      * Returns <tt>false</tt> if the cookie should be discarded at the end
92      * of the "session"; <tt>true</tt> otherwise.
93      *
94      * @return <tt>false</tt> if the cookie should be discarded at the end
95      *         of the "session"; <tt>true</tt> otherwise
96      */
isPersistent()97     boolean isPersistent();
98 
99     /**
100      * Returns domain attribute of the cookie.
101      *
102      * @return the value of the domain attribute
103      */
getDomain()104     String getDomain();
105 
106     /**
107      * Returns the path attribute of the cookie
108      *
109      * @return The value of the path attribute.
110      */
getPath()111     String getPath();
112 
113     /**
114      * Get the Port attribute. It restricts the ports to which a cookie
115      * may be returned in a Cookie request header.
116      */
getPorts()117     int[] getPorts();
118 
119     /**
120      * Indicates whether this cookie requires a secure connection.
121      *
122      * @return  <code>true</code> if this cookie should only be sent
123      *          over secure connections, <code>false</code> otherwise.
124      */
isSecure()125     boolean isSecure();
126 
127     /**
128      * Returns the version of the cookie specification to which this
129      * cookie conforms.
130      *
131      * @return the version of the cookie.
132      */
getVersion()133     int getVersion();
134 
135     /**
136      * Returns true if this cookie has expired.
137      * @param date Current time
138      *
139      * @return <tt>true</tt> if the cookie has expired.
140      */
isExpired(final Date date)141     boolean isExpired(final Date date);
142 
143 }
144 
145