001/*
002 * ====================================================================
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 * ====================================================================
020 *
021 * This software consists of voluntary contributions made by many
022 * individuals on behalf of the Apache Software Foundation.  For more
023 * information on the Apache Software Foundation, please see
024 * <http://www.apache.org/>.
025 *
026 */
027
028package org.apache.http.cookie;
029
030import java.util.Date;
031
032import org.apache.http.annotation.Obsolete;
033
034/**
035 * This interface represents a {@code Set-Cookie} response header sent by the
036 * origin server to the HTTP agent in order to maintain a conversational state.
037 * <p>
038 * Please do not use methods marked as @Obsolete. They have been rendered
039 * obsolete by RFC 6265
040 *
041 * @since 4.0
042 */
043public interface SetCookie extends Cookie {
044
045    void setValue(String value);
046
047    /**
048     * If a user agent (web browser) presents this cookie to a user, the
049     * cookie's purpose will be described using this comment.
050     *
051     * @param comment
052     *
053     * @see #getComment()
054     */
055    @Obsolete
056    void setComment(String comment);
057
058    /**
059     * Sets expiration date.
060     * <p><strong>Note:</strong> the object returned by this method is considered
061     * immutable. Changing it (e.g. using setTime()) could result in undefined
062     * behaviour. Do so at your peril.</p>
063     *
064     * @param expiryDate the {@link Date} after which this cookie is no longer valid.
065     *
066     * @see Cookie#getExpiryDate
067     *
068     */
069    void setExpiryDate (Date expiryDate);
070
071    /**
072     * Sets the domain attribute.
073     *
074     * @param domain The value of the domain attribute
075     *
076     * @see Cookie#getDomain
077     */
078    void setDomain(String domain);
079
080    /**
081     * Sets the path attribute.
082     *
083     * @param path The value of the path attribute
084     *
085     * @see Cookie#getPath
086     *
087     */
088    void setPath(String path);
089
090    /**
091     * Sets the secure attribute of the cookie.
092     * <p>
093     * When {@code true} the cookie should only be sent
094     * using a secure protocol (https).  This should only be set when
095     * the cookie's originating server used a secure protocol to set the
096     * cookie's value.
097     *
098     * @param secure The value of the secure attribute
099     *
100     * @see #isSecure()
101     */
102    void setSecure (boolean secure);
103
104    /**
105     * Sets the version of the cookie specification to which this
106     * cookie conforms.
107     *
108     * @param version the version of the cookie.
109     *
110     * @see Cookie#getVersion
111     */
112    @Obsolete
113    void setVersion(int version);
114
115}
116