1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/cookie/Cookie.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,137 @@ 1.4 +/* 1.5 + * ==================================================================== 1.6 + * Licensed to the Apache Software Foundation (ASF) under one 1.7 + * or more contributor license agreements. See the NOTICE file 1.8 + * distributed with this work for additional information 1.9 + * regarding copyright ownership. The ASF licenses this file 1.10 + * to you under the Apache License, Version 2.0 (the 1.11 + * "License"); you may not use this file except in compliance 1.12 + * with the License. You may obtain a copy of the License at 1.13 + * 1.14 + * http://www.apache.org/licenses/LICENSE-2.0 1.15 + * 1.16 + * Unless required by applicable law or agreed to in writing, 1.17 + * software distributed under the License is distributed on an 1.18 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1.19 + * KIND, either express or implied. See the License for the 1.20 + * specific language governing permissions and limitations 1.21 + * under the License. 1.22 + * ==================================================================== 1.23 + * 1.24 + * This software consists of voluntary contributions made by many 1.25 + * individuals on behalf of the Apache Software Foundation. For more 1.26 + * information on the Apache Software Foundation, please see 1.27 + * <http://www.apache.org/>. 1.28 + * 1.29 + */ 1.30 + 1.31 +package ch.boye.httpclientandroidlib.cookie; 1.32 + 1.33 +import java.util.Date; 1.34 + 1.35 +/** 1.36 + * Cookie interface represents a token or short packet of state information 1.37 + * (also referred to as "magic-cookie") that the HTTP agent and the target 1.38 + * server can exchange to maintain a session. In its simples form an HTTP 1.39 + * cookie is merely a name / value pair. 1.40 + * 1.41 + * @since 4.0 1.42 + */ 1.43 +public interface Cookie { 1.44 + 1.45 + /** 1.46 + * Returns the name. 1.47 + * 1.48 + * @return String name The name 1.49 + */ 1.50 + String getName(); 1.51 + 1.52 + /** 1.53 + * Returns the value. 1.54 + * 1.55 + * @return String value The current value. 1.56 + */ 1.57 + String getValue(); 1.58 + 1.59 + /** 1.60 + * Returns the comment describing the purpose of this cookie, or 1.61 + * <tt>null</tt> if no such comment has been defined. 1.62 + * 1.63 + * @return comment 1.64 + */ 1.65 + String getComment(); 1.66 + 1.67 + /** 1.68 + * If a user agent (web browser) presents this cookie to a user, the 1.69 + * cookie's purpose will be described by the information at this URL. 1.70 + */ 1.71 + String getCommentURL(); 1.72 + 1.73 + /** 1.74 + * Returns the expiration {@link Date} of the cookie, or <tt>null</tt> 1.75 + * if none exists. 1.76 + * <p><strong>Note:</strong> the object returned by this method is 1.77 + * considered immutable. Changing it (e.g. using setTime()) could result 1.78 + * in undefined behaviour. Do so at your peril. </p> 1.79 + * @return Expiration {@link Date}, or <tt>null</tt>. 1.80 + */ 1.81 + Date getExpiryDate(); 1.82 + 1.83 + /** 1.84 + * Returns <tt>false</tt> if the cookie should be discarded at the end 1.85 + * of the "session"; <tt>true</tt> otherwise. 1.86 + * 1.87 + * @return <tt>false</tt> if the cookie should be discarded at the end 1.88 + * of the "session"; <tt>true</tt> otherwise 1.89 + */ 1.90 + boolean isPersistent(); 1.91 + 1.92 + /** 1.93 + * Returns domain attribute of the cookie. The value of the Domain 1.94 + * attribute specifies the domain for which the cookie is valid. 1.95 + * 1.96 + * @return the value of the domain attribute. 1.97 + */ 1.98 + String getDomain(); 1.99 + 1.100 + /** 1.101 + * Returns the path attribute of the cookie. The value of the Path 1.102 + * attribute specifies the subset of URLs on the origin server to which 1.103 + * this cookie applies. 1.104 + * 1.105 + * @return The value of the path attribute. 1.106 + */ 1.107 + String getPath(); 1.108 + 1.109 + /** 1.110 + * Get the Port attribute. It restricts the ports to which a cookie 1.111 + * may be returned in a Cookie request header. 1.112 + */ 1.113 + int[] getPorts(); 1.114 + 1.115 + /** 1.116 + * Indicates whether this cookie requires a secure connection. 1.117 + * 1.118 + * @return <code>true</code> if this cookie should only be sent 1.119 + * over secure connections, <code>false</code> otherwise. 1.120 + */ 1.121 + boolean isSecure(); 1.122 + 1.123 + /** 1.124 + * Returns the version of the cookie specification to which this 1.125 + * cookie conforms. 1.126 + * 1.127 + * @return the version of the cookie. 1.128 + */ 1.129 + int getVersion(); 1.130 + 1.131 + /** 1.132 + * Returns true if this cookie has expired. 1.133 + * @param date Current time 1.134 + * 1.135 + * @return <tt>true</tt> if the cookie has expired. 1.136 + */ 1.137 + boolean isExpired(final Date date); 1.138 + 1.139 +} 1.140 +