public class ServletCookie extends H.Cookie
Adapt Cookie to H.Cookie
H.Cookie.F| Constructor and Description |
|---|
ServletCookie(javax.servlet.http.Cookie cookie) |
| Modifier and Type | Method and Description |
|---|---|
static javax.servlet.http.Cookie |
asServletCookie(H.Cookie c) |
String |
domain()
Returns the domain of the cookie
|
ServletCookie |
domain(String domain)
Set the domain of the cookie
|
int |
maxAge()
Returns the maximum age of cookie specified in seconds.
|
ServletCookie |
maxAge(int maxAge)
Set the max age of the cookie in seconds.
|
String |
name()
Returns the name of the cookie.
|
static ServletCookie |
of(javax.servlet.http.Cookie c) |
String |
path()
Returns the path on the server to which the browser returns this cookie.
|
ServletCookie |
path(String uri)
Specifies a path for the cookie to which the client should return the cookie.
|
boolean |
secure()
Returns
true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol. |
ServletCookie |
secure(boolean secure)
Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
|
String |
value()
Returns the value of the cookie
|
ServletCookie |
value(String value)
Set a value to a cookie and the return
this cookie |
public String name()
H.CookieReturns the name of the cookie. Cookie name cannot be changed after created
public ServletCookie value(String value)
H.CookieSet a value to a cookie and the return this cookie
public String domain()
H.CookieReturns the domain of the cookie
public ServletCookie domain(String domain)
H.CookieSet the domain of the cookie
public String path()
H.CookieReturns the path on the server to which the browser returns this cookie. The cookie is visible to all subpaths on the server.
path in class H.CookieH.Cookie.path(String)public ServletCookie path(String uri)
H.CookieSpecifies a path for the cookie to which the client should return the cookie.
The cookie is visible to all the pages in the directory you specify, and all the pages in that directory’s subdirectories.
Consult RFC 2109 (available on the Internet) for more information on setting path names for cookies.
path in class H.Cookieuri - a String specifying a pathH.Cookie.pathpublic int maxAge()
H.CookieReturns the maximum age of cookie specified in seconds. If maxAge is set to -1 then the cookie will persist until browser shutdown
public ServletCookie maxAge(int maxAge)
H.CookieSet the max age of the cookie in seconds.
A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie’s current age.
A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.
maxAge in class H.CookiemaxAge - the max age to be setH.Cookie.maxAge()public boolean secure()
H.CookieReturns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
secure in class H.CookieH.Cookie.secure(boolean)public ServletCookie secure(boolean secure)
H.CookieIndicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
The default value is false.
public static ServletCookie of(javax.servlet.http.Cookie c)
public static javax.servlet.http.Cookie asServletCookie(H.Cookie c)
Copyright © 2017–2020 OSGL (Open Source General Library). All rights reserved.