public class NewCookie extends Cookie
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_AGE
Specifies that the cookie expires with the current application/browser session.
|
DEFAULT_VERSION
Constructor and Description |
---|
NewCookie(Cookie cookie)
Create a new instance copying the information in the supplied cookie.
|
NewCookie(Cookie cookie,
String comment,
int maxAge,
boolean secure)
Create a new instance supplementing the information in the supplied cookie.
|
NewCookie(String name,
String value)
Create a new instance.
|
NewCookie(String name,
String value,
String path,
String domain,
int version,
String comment,
int maxAge,
boolean secure)
Create a new instance.
|
NewCookie(String name,
String value,
String path,
String domain,
String comment,
int maxAge,
boolean secure)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compare for equality.
|
String |
getComment()
Get the comment associated with the cookie.
|
int |
getMaxAge()
Get the maximum age of the the cookie in seconds.
|
int |
hashCode()
Generate a hashcode by hashing all of the properties
|
boolean |
isSecure()
Whether the cookie will only be sent over a secure connection.
|
Cookie |
toCookie()
Obtain a new instance of a
Cookie with the same name, value, path,
domain and version as this NewCookie . |
String |
toString()
Convert the cookie to a string suitable for use as the value of the
corresponding HTTP header.
|
static NewCookie |
valueOf(String value)
Creates a new instance of NewCookie by parsing the supplied string.
|
public static final int DEFAULT_MAX_AGE
public NewCookie(String name, String value)
name
- the name of the cookievalue
- the value of the cookieIllegalArgumentException
- if name is nullpublic NewCookie(String name, String value, String path, String domain, String comment, int maxAge, boolean secure)
name
- the name of the cookievalue
- the value of the cookiepath
- the URI path for which the cookie is validdomain
- the host domain for which the cookie is validcomment
- the commentmaxAge
- the maximum age of the cookie in secondssecure
- specifies whether the cookie will only be sent over a secure connectionIllegalArgumentException
- if name is nullpublic NewCookie(String name, String value, String path, String domain, int version, String comment, int maxAge, boolean secure)
name
- the name of the cookievalue
- the value of the cookiepath
- the URI path for which the cookie is validdomain
- the host domain for which the cookie is validversion
- the version of the specification to which the cookie compliescomment
- the commentmaxAge
- the maximum age of the cookie in secondssecure
- specifies whether the cookie will only be sent over a secure connectionIllegalArgumentException
- if name is nullpublic NewCookie(Cookie cookie)
cookie
- the cookie to cloneIllegalArgumentException
- if cookie is nullpublic NewCookie(Cookie cookie, String comment, int maxAge, boolean secure)
cookie
- the cookie to clonecomment
- the commentmaxAge
- the maximum age of the cookie in secondssecure
- specifies whether the cookie will only be sent over a secure connectionIllegalArgumentException
- if cookie is nullpublic static NewCookie valueOf(String value) throws IllegalArgumentException
value
- the cookie stringIllegalArgumentException
- if the supplied string cannot be parsed
or is nullpublic String getComment()
public int getMaxAge()
public boolean isSecure()
public Cookie toCookie()
Cookie
with the same name, value, path,
domain and version as this NewCookie
. This method can be used to
obtain an object that can be compared for equality with another Cookie
;
since a Cookie
will never compare equal to a NewCookie
.Cookie
public String toString()
public int hashCode()
public boolean equals(Object obj)
toCookie()
to compare a
NewCookie
to a Cookie
considering only the common
properties.Copyright © 2018 JBoss by Red Hat. All rights reserved.