Creates a javax.servlet.http.Cookie but does NOT add the cookie to the response object. Once the cookie has been added to the response, it is no longer possible to change the cookie.
This method should be used in conjunction with #addCookie(Cookie)
The age parameter specifies the lifetime of the cookie in seconds.
A negative value denotes a session cookie i.e. not persisted on the client.
A value of 0 deletes the cookie.
NB The new cookie's value will not be available to getCookieValue() until the next request.
Javascript example:
var newCookie = client.createCookie("FullName", "Joe Bloggs", 1000000);
newCookie.setSecure(true);
newCookie.setHttpOnly(true);
client.addCookie(newCookie);
returns javax.servlet.http.Cookie
Parameters
java.lang.String
cookieName,
java.lang.String
cookieValue,
int
age,
javax.servlet.http.Cookie
but does NOT add the cookie to the response object. Once the cookie has been added to the response, it is no longer possible to change the cookie. This method should be used in conjunction with #addCookie(Cookie)The
age
parameter specifies the lifetime of the cookie in seconds. A negative value denotes a session cookie i.e. not persisted on the client. A value of 0 deletes the cookie. NB The new cookie's value will not be available to getCookieValue() until the next request.Javascript example: