michael@0: /* michael@0: * ==================================================================== michael@0: * Licensed to the Apache Software Foundation (ASF) under one michael@0: * or more contributor license agreements. See the NOTICE file michael@0: * distributed with this work for additional information michael@0: * regarding copyright ownership. The ASF licenses this file michael@0: * to you under the Apache License, Version 2.0 (the michael@0: * "License"); you may not use this file except in compliance michael@0: * with the License. You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, michael@0: * software distributed under the License is distributed on an michael@0: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY michael@0: * KIND, either express or implied. See the License for the michael@0: * specific language governing permissions and limitations michael@0: * under the License. michael@0: * ==================================================================== michael@0: * michael@0: * This software consists of voluntary contributions made by many michael@0: * individuals on behalf of the Apache Software Foundation. For more michael@0: * information on the Apache Software Foundation, please see michael@0: * . michael@0: * michael@0: */ michael@0: michael@0: package ch.boye.httpclientandroidlib.cookie; michael@0: michael@0: import java.util.Date; michael@0: michael@0: /** michael@0: * Cookie interface represents a token or short packet of state information michael@0: * (also referred to as "magic-cookie") that the HTTP agent and the target michael@0: * server can exchange to maintain a session. In its simples form an HTTP michael@0: * cookie is merely a name / value pair. michael@0: * michael@0: * @since 4.0 michael@0: */ michael@0: public interface Cookie { michael@0: michael@0: /** michael@0: * Returns the name. michael@0: * michael@0: * @return String name The name michael@0: */ michael@0: String getName(); michael@0: michael@0: /** michael@0: * Returns the value. michael@0: * michael@0: * @return String value The current value. michael@0: */ michael@0: String getValue(); michael@0: michael@0: /** michael@0: * Returns the comment describing the purpose of this cookie, or michael@0: * null if no such comment has been defined. michael@0: * michael@0: * @return comment michael@0: */ michael@0: String getComment(); michael@0: michael@0: /** michael@0: * If a user agent (web browser) presents this cookie to a user, the michael@0: * cookie's purpose will be described by the information at this URL. michael@0: */ michael@0: String getCommentURL(); michael@0: michael@0: /** michael@0: * Returns the expiration {@link Date} of the cookie, or null michael@0: * if none exists. michael@0: *

Note: the object returned by this method is michael@0: * considered immutable. Changing it (e.g. using setTime()) could result michael@0: * in undefined behaviour. Do so at your peril.

michael@0: * @return Expiration {@link Date}, or null. michael@0: */ michael@0: Date getExpiryDate(); michael@0: michael@0: /** michael@0: * Returns false if the cookie should be discarded at the end michael@0: * of the "session"; true otherwise. michael@0: * michael@0: * @return false if the cookie should be discarded at the end michael@0: * of the "session"; true otherwise michael@0: */ michael@0: boolean isPersistent(); michael@0: michael@0: /** michael@0: * Returns domain attribute of the cookie. The value of the Domain michael@0: * attribute specifies the domain for which the cookie is valid. michael@0: * michael@0: * @return the value of the domain attribute. michael@0: */ michael@0: String getDomain(); michael@0: michael@0: /** michael@0: * Returns the path attribute of the cookie. The value of the Path michael@0: * attribute specifies the subset of URLs on the origin server to which michael@0: * this cookie applies. michael@0: * michael@0: * @return The value of the path attribute. michael@0: */ michael@0: String getPath(); michael@0: michael@0: /** michael@0: * Get the Port attribute. It restricts the ports to which a cookie michael@0: * may be returned in a Cookie request header. michael@0: */ michael@0: int[] getPorts(); michael@0: michael@0: /** michael@0: * Indicates whether this cookie requires a secure connection. michael@0: * michael@0: * @return true if this cookie should only be sent michael@0: * over secure connections, false otherwise. michael@0: */ michael@0: boolean isSecure(); michael@0: michael@0: /** michael@0: * Returns the version of the cookie specification to which this michael@0: * cookie conforms. michael@0: * michael@0: * @return the version of the cookie. michael@0: */ michael@0: int getVersion(); michael@0: michael@0: /** michael@0: * Returns true if this cookie has expired. michael@0: * @param date Current time michael@0: * michael@0: * @return true if the cookie has expired. michael@0: */ michael@0: boolean isExpired(final Date date); michael@0: michael@0: } michael@0: