View Javadoc

1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.http.cookie;
29  
30  import java.util.Date;
31  
32  /**
33   * This interface represents a <code>Set-Cookie</code> response header sent by the
34   * origin server to the HTTP agent in order to maintain a conversational state.
35   *
36   * @since 4.0
37   */
38  public interface SetCookie extends Cookie {
39  
40      void setValue(String value);
41  
42      /**
43       * If a user agent (web browser) presents this cookie to a user, the
44       * cookie's purpose will be described using this comment.
45       *
46       * @param comment
47       *
48       * @see #getComment()
49       */
50      void setComment(String comment);
51  
52      /**
53       * Sets expiration date.
54       * <p><strong>Note:</strong> the object returned by this method is considered
55       * immutable. Changing it (e.g. using setTime()) could result in undefined
56       * behaviour. Do so at your peril.</p>
57       *
58       * @param expiryDate the {@link Date} after which this cookie is no longer valid.
59       *
60       * @see Cookie#getExpiryDate
61       *
62       */
63      void setExpiryDate (Date expiryDate);
64  
65      /**
66       * Sets the domain attribute.
67       *
68       * @param domain The value of the domain attribute
69       *
70       * @see Cookie#getDomain
71       */
72      void setDomain(String domain);
73  
74      /**
75       * Sets the path attribute.
76       *
77       * @param path The value of the path attribute
78       *
79       * @see Cookie#getPath
80       *
81       */
82      void setPath(String path);
83  
84      /**
85       * Sets the secure attribute of the cookie.
86       * <p>
87       * When {@code true} the cookie should only be sent
88       * using a secure protocol (https).  This should only be set when
89       * the cookie's originating server used a secure protocol to set the
90       * cookie's value.
91       *
92       * @param secure The value of the secure attribute
93       *
94       * @see #isSecure()
95       */
96      void setSecure (boolean secure);
97  
98      /**
99       * Sets the version of the cookie specification to which this
100      * cookie conforms.
101      *
102      * @param version the version of the cookie.
103      *
104      * @see Cookie#getVersion
105      */
106     void setVersion(int version);
107 
108 }
109