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.hc.client5.http.cookie; 29 30 import java.util.Date; 31 32 /** 33 * This interface represents a {@code Set-Cookie} 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 * Sets expiration date. 44 * <p><strong>Note:</strong> the object returned by this method is considered 45 * immutable. Changing it (e.g. using setTime()) could result in undefined 46 * behaviour. Do so at your peril.</p> 47 * 48 * @param expiryDate the {@link Date} after which this cookie is no longer valid. 49 * 50 * @see Cookie#getExpiryDate 51 * 52 */ 53 void setExpiryDate (Date expiryDate); 54 55 /** 56 * Sets the domain attribute. 57 * 58 * @param domain The value of the domain attribute 59 * 60 * @see Cookie#getDomain 61 */ 62 void setDomain(String domain); 63 64 /** 65 * Sets the path attribute. 66 * 67 * @param path The value of the path attribute 68 * 69 * @see Cookie#getPath 70 * 71 */ 72 void setPath(String path); 73 74 /** 75 * Sets the secure attribute of the cookie. 76 * <p> 77 * When {@code true} the cookie should only be sent 78 * using a secure protocol (https). This should only be set when 79 * the cookie's originating server used a secure protocol to set the 80 * cookie's value. 81 * 82 * @param secure The value of the secure attribute 83 * 84 * @see #isSecure() 85 */ 86 void setSecure (boolean secure); 87 88 } 89