Class SimpleHttpCookie.Builder
- java.lang.Object
-
- com.kttdevelopment.simplehttpserver.SimpleHttpCookie.Builder
-
- Enclosing class:
- SimpleHttpCookie
public static class SimpleHttpCookie.Builder extends Object
Builder class forSimpleHttpCookie.- Since:
- 02.03.00
- Version:
- 02.03.00
- Author:
- Ktt Development
- See Also:
SimpleHttpCookie
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleHttpCookiebuild()Returns the completed cookie.StringgetDomain()Returns the domain to send the cookie to.DategetExpires()Returns when the cookie should expire.intgetMaxAge()Returns how long the cookie should exist for.StringgetName()Returns the name of the cookie.StringgetPath()Returns the path to send the cookie to.StringgetValue()Returns the value of the cookie.booleanisHttpOnly()Returns if only the server should have access to the cookies.StringisSameSite()Returns if the cookie should be prevented from being sent cross-site.booleanisSecure()Returns if the cookie must be sent over a secure/HTTPS protocol.SimpleHttpCookie.BuildersetDomain(String domain)Sets the domain of the cookie.SimpleHttpCookie.BuildersetExpires(Date expires)Sets when the cookie should expire.SimpleHttpCookie.BuildersetHttpOnly(boolean httpOnly)Sets if only the server should have access to the cookies.SimpleHttpCookie.BuildersetMaxAge(int maxAge)Sets how long the cookie should exist for.SimpleHttpCookie.BuildersetPath(String path)Sets the path of the cookie.SimpleHttpCookie.BuildersetSameSite(String sameSite)Sets if the cookie should be prevented from being sent cross-site.SimpleHttpCookie.BuildersetSecure(boolean secure)Sets if the cookie must be sent over a secure/HTTPS protocol.
-
-
-
Method Detail
-
getName
public final String getName()
Returns the name of the cookie.- Returns:
- cookie name
- Since:
- 02.00.00
-
getValue
public final String getValue()
Returns the value of the cookie.- Returns:
- cookie value
- Since:
- 02.03.00
-
getDomain
public final String getDomain()
Returns the domain to send the cookie to.- Returns:
- domain to send the cookie to
- Since:
- 02.03.00
- See Also:
setDomain(String)
-
setDomain
public final SimpleHttpCookie.Builder setDomain(String domain)
Sets the domain of the cookie.- Parameters:
domain- what domain to send the cookie to- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
getDomain()
-
getPath
public final String getPath()
Returns the path to send the cookie to.- Returns:
- what path to send the cookie to
- Since:
- 02.03.00
- See Also:
setPath(String)
-
setPath
public final SimpleHttpCookie.Builder setPath(String path)
Sets the path of the cookie.- Parameters:
path- what path to send the cookie to- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
getPath()
-
isSameSite
public final String isSameSite()
Returns if the cookie should be prevented from being sent cross-site.- Returns:
- if the cookie should be prevented from being sent cross-site.
- Since:
- 02.03.00
- See Also:
setSameSite(String)
-
setSameSite
public final SimpleHttpCookie.Builder setSameSite(String sameSite)
Sets if the cookie should be prevented from being sent cross-site.- Parameters:
sameSite- if the cookie should be prevented from being sent cross-site- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
isSameSite()
-
getExpires
public final Date getExpires()
Returns when the cookie should expire.- Returns:
- when the cookie should expire.
- Since:
- 02.03.00
- See Also:
setExpires(Date),getMaxAge(),setMaxAge(int)
-
setExpires
public final SimpleHttpCookie.Builder setExpires(Date expires)
Sets when the cookie should expire.- Parameters:
expires- when the cookie should expire- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
getExpires(),getMaxAge(),setMaxAge(int)
-
getMaxAge
public final int getMaxAge()
Returns how long the cookie should exist for.- Returns:
- how long the cookie should exist for
- Since:
- 02.03.00
- See Also:
getExpires(),setExpires(Date),setMaxAge(int)
-
setMaxAge
public final SimpleHttpCookie.Builder setMaxAge(int maxAge)
Sets how long the cookie should exist for.- Parameters:
maxAge- how long the cookie should exist for- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
getExpires(),setExpires(Date),getMaxAge()
-
isSecure
public final boolean isSecure()
Returns if the cookie must be sent over a secure/HTTPS protocol.- Returns:
- if the cookie must be sent over a secure/HTTPS protocol
- Since:
- 02.03.00
- See Also:
isSecure()
-
setSecure
public final SimpleHttpCookie.Builder setSecure(boolean secure)
Sets if the cookie must be sent over a secure/HTTPS protocol.- Parameters:
secure- if the cookie must be sent over a secure/HTTPS protocol.- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
setSecure(boolean)
-
isHttpOnly
public final boolean isHttpOnly()
Returns if only the server should have access to the cookies.- Returns:
- if only the server should have access to the cookies.
- Since:
- 02.03.00
- See Also:
setHttpOnly(boolean)
-
setHttpOnly
public final SimpleHttpCookie.Builder setHttpOnly(boolean httpOnly)
Sets if only the server should have access to the cookies.- Parameters:
httpOnly- if only the server should have access to the cookies- Returns:
- cookie builder
- Since:
- 02.03.00
- See Also:
isHttpOnly()
-
build
public final SimpleHttpCookie build()
Returns the completed cookie.- Returns:
- simple http cookie
- Since:
- 02.03.00
-
-