
wee0.net.IHttpCookie Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2016-2022, wee0.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package wee0.net;
/**
* Cookie HTTP cookie.
*
* @author baihw
**/
public interface IHttpCookie{
/**
* 获取cookie名称
*
* @return cookie名称
*/
String getName();
/**
* 设置cookie值
*
* @param value cookie值
*/
void setValue( String value );
/**
* 获取cookie值
*
* @return cookie值
*/
String getValue();
/**
* 设置cookie域
*
* @param domain cookie域
*/
void setDomain( String domain );
/**
* 获取cookie域
*
* @return cookie域
*/
String getDomain();
/**
* 获取cookie路径
*
* @param path cookie路径
*/
void setPath( String path );
/**
* 获取cookie路径
*
* @return cookie路径
*/
String getPath();
/**
* 设置cookie最大存活时间,以秒为单位。如果为0,则立即删除。如果为负数,则浏览器关闭时销毁。
*
* @param maxAge cookie最大存活时间
*/
void setMaxAge( long maxAge );
/**
* 获取cookie最大存活时间。
*
* @return cookie最大存活时间
*/
long getMaxAge();
/**
* 设置cookie是否仅在https中保持。
*
* @param secure cookie是否仅在https中保持。
*/
void setSecure( boolean secure );
/**
* 获取cookie是否仅在https中保持。
*
* @return cookie是否仅在https中保持。
*/
boolean isSecure();
/**
* 设置cookie是否不允许js读取。如果为true,则不允许js读取此cookie。参考:here
*
* @param httpOnly cookie是否不允许js读取
*/
void setHttpOnly( boolean httpOnly );
/**
* 获取cookie是否不允许js读取
*
* @return cookie是否不允许js读取。
*/
boolean isHttpOnly();
} // end class