public interface ResponseCookie extends Cookie, org.refcodes.mixin.PathAccessor.PathProperty, org.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>, org.refcodes.mixin.DomainAccessor.DomainProperty, org.refcodes.mixin.DomainAccessor.DomainBuilder<ResponseCookie>
ResponseCookie
represents a builder for building response
cookies.
We use URL encoding / decoding for the cookie value (regarding
fromHttpCookie(String)
and toHttpCookie()
) to make life
easier and not fall into the trap of unescaped values.org.refcodes.structure.Property.PropertyBuilder
org.refcodes.structure.Relation.RelationBuilder<K,V>
org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B extends org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B>>, org.refcodes.mixin.KeyAccessor.KeyMutator<K>, org.refcodes.mixin.KeyAccessor.KeyProperty<K>
org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V>, org.refcodes.mixin.ValueAccessor.ValueProperty<V>
Modifier and Type | Method and Description |
---|---|
default void |
fromHttpCookie(String aHttpCookie)
Sets the cookie according to the provided HTTP cookie text.
|
Date |
getExpiresDate()
Returns the expiration date of this
ResponseCookie . |
boolean |
isHttpOnly()
Returns true if we have an HTTP only cookie.
|
boolean |
isSecure()
Returns true if we have a secure HTTP cookie.
|
void |
setExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit,
long aTime)
Sets the expires date to the current time plus the provided time.
|
void |
setExpiresDate(Date aExpireDate)
Sets the expiration date of this cookie.
|
void |
setHttpOnly(boolean isHttpOnly)
Sets whether it be an HTTP only cookie.
|
void |
setSecure(boolean isSecure)
Sets whether it be a secure HTTP cookie.
|
default String |
toHttpCookie()
Returns the cookie to be assigned to a cookie Header-Field.
|
default ResponseCookie |
withDomain(String aDomain)
Sets the domain for this cookie.
|
default ResponseCookie |
withExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit,
long aTime)
Builder method for the method
setExpiresAfter(TimeUnit, long) . |
default ResponseCookie |
withExpiresDate(Date aExpiresDate)
Sets the expiration date of this cookie and returns this instance as of
the Builder-Pattern.
|
default ResponseCookie |
withHttpCookie(String aCookie)
Sets the cookie according to the provided HTTP cookie text via
Cookie.fromHttpCookie(String) . |
default ResponseCookie |
withHttpOnly(boolean isHttpOnly)
Sets whether it be an HTTP only cookie.
|
default ResponseCookie |
withPath(String aPath)
Sets the path of the cookie.
|
default ResponseCookie |
withSecure(boolean isSecure)
Sets whether it be a secure HTTP cookie.
|
void setExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit, long aTime)
getExpiresDate()
to retrieve the resulting effective
Date
.aTimeUnit
- The TimeUnit
of the provided timeaTime
- The provided time after which to expiredefault ResponseCookie withExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit, long aTime)
setExpiresAfter(TimeUnit, long)
.aTimeUnit
- The TimeUnit
of the provided timeaTime
- The provided time after which to expireResponseCookie
instance for further configuration.Date getExpiresDate()
ResponseCookie
.void setExpiresDate(Date aExpireDate)
aExpireDate
- The expiration date.default ResponseCookie withExpiresDate(Date aExpiresDate)
aExpiresDate
- the a expires datedefault ResponseCookie withPath(String aPath)
withPath
in interface org.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>
default ResponseCookie withDomain(String aDomain)
withDomain
in interface org.refcodes.mixin.DomainAccessor.DomainBuilder<ResponseCookie>
boolean isHttpOnly()
void setHttpOnly(boolean isHttpOnly)
isHttpOnly
- True in case of being an HTTP only cookie.default ResponseCookie withHttpOnly(boolean isHttpOnly)
isHttpOnly
- True in case of being an HTTP only cookie.boolean isSecure()
void setSecure(boolean isSecure)
isSecure
- True in case of being a secure only cookie.default ResponseCookie withSecure(boolean isSecure)
isSecure
- True in case of being a secure only cookie.default ResponseCookie withHttpCookie(String aCookie)
Cookie
Cookie.fromHttpCookie(String)
.withHttpCookie
in interface Cookie
aCookie
- The HTTP cookie text.Cookie
instance as of the Builder-Pattern.default void fromHttpCookie(String aHttpCookie)
Cookie
fromHttpCookie
in interface Cookie
aHttpCookie
- The HTTP cookie text.default String toHttpCookie()
Cookie
toHttpCookie
in interface Cookie
Copyright © 2017. All rights reserved.