public class Cookie extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Cookie.Builder |
Constructor and Description |
---|
Cookie(String name,
String value)
Create a cookie for the default path with the given name and value with no expiry set.
|
Cookie(String name,
String value,
String path)
Create a cookie.
|
Cookie(String name,
String value,
String path,
Date expiry)
Creates an insecure non-httpOnly cookie with no domain specified.
|
Cookie(String name,
String value,
String domain,
String path,
Date expiry)
Creates an insecure non-httpOnly cookie.
|
Cookie(String name,
String value,
String domain,
String path,
Date expiry,
boolean isSecure)
Creates a non-httpOnly cookie.
|
Cookie(String name,
String value,
String domain,
String path,
Date expiry,
boolean isSecure,
boolean isHttpOnly)
Creates a cookie.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Two cookies are equal if the name and value match
|
String |
getDomain() |
Date |
getExpiry() |
String |
getName() |
String |
getPath() |
String |
getValue() |
int |
hashCode() |
boolean |
isHttpOnly() |
boolean |
isSecure() |
String |
toString() |
void |
validate() |
public Cookie(String name, String value, String path, Date expiry)
name
- The name of the cookie; may not be null or an empty string.value
- The cookie value; may not be null.path
- The path the cookie is visible to. If left blank or set to null, will be set to
"/".expiry
- The cookie's expiration date; may be null.Cookie(String, String, String, String, Date)
public Cookie(String name, String value, String domain, String path, Date expiry)
name
- The name of the cookie; may not be null or an empty string.value
- The cookie value; may not be null.domain
- The domain the cookie is visible to.path
- The path the cookie is visible to. If left blank or set to null, will be set to
"/".expiry
- The cookie's expiration date; may be null.Cookie(String, String, String, String, Date, boolean)
public Cookie(String name, String value, String domain, String path, Date expiry, boolean isSecure)
name
- The name of the cookie; may not be null or an empty string.value
- The cookie value; may not be null.domain
- The domain the cookie is visible to.path
- The path the cookie is visible to. If left blank or set to null, will be set to
"/".expiry
- The cookie's expiration date; may be null.isSecure
- Whether this cookie requires a secure connection.public Cookie(String name, String value, String domain, String path, Date expiry, boolean isSecure, boolean isHttpOnly)
name
- The name of the cookie; may not be null or an empty string.value
- The cookie value; may not be null.domain
- The domain the cookie is visible to.path
- The path the cookie is visible to. If left blank or set to null, will be set to
"/".expiry
- The cookie's expiration date; may be null.isSecure
- Whether this cookie requires a secure connection.isHttpOnly
- Whether this cookie is a httpOnly cooke.public Cookie(String name, String value)
name
- The cookie's namevalue
- The cookie's valuepublic String getName()
public String getValue()
public String getDomain()
public String getPath()
public boolean isSecure()
public boolean isHttpOnly()
public Date getExpiry()
public void validate()
public boolean equals(Object o)
Copyright © 2014. All rights reserved.