- All Superinterfaces:
Cookie,org.refcodes.mixin.DomainAccessor,org.refcodes.mixin.DomainAccessor.DomainBuilder<ResponseCookie>,org.refcodes.mixin.DomainAccessor.DomainMutator,org.refcodes.mixin.DomainAccessor.DomainProperty,org.refcodes.mixin.KeyAccessor<String>,org.refcodes.mixin.KeyAccessor.KeyBuilder<String,org.refcodes.struct.Relation.RelationBuilder<String,String>>,org.refcodes.mixin.KeyAccessor.KeyMutator<String>,org.refcodes.mixin.KeyAccessor.KeyProperty<String>,org.refcodes.mixin.PathAccessor,org.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>,org.refcodes.mixin.PathAccessor.PathMutator,org.refcodes.mixin.PathAccessor.PathProperty,org.refcodes.struct.Property,org.refcodes.struct.Property.PropertyBuilder,org.refcodes.struct.Relation<String,String>,org.refcodes.struct.Relation.RelationBuilder<String,String>,org.refcodes.mixin.ValueAccessor<String>,org.refcodes.mixin.ValueAccessor.ValueBuilder<String,org.refcodes.struct.Relation.RelationBuilder<String,String>>,org.refcodes.mixin.ValueAccessor.ValueMutator<String>,org.refcodes.mixin.ValueAccessor.ValueProperty<String>
- All Known Implementing Classes:
ResponseCookieImpl
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>
The
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.DomainAccessor
org.refcodes.mixin.DomainAccessor.DomainBuilder<B extends org.refcodes.mixin.DomainAccessor.DomainBuilder<?>>, org.refcodes.mixin.DomainAccessor.DomainMutator, org.refcodes.mixin.DomainAccessor.DomainPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.KeyAccessor
org.refcodes.mixin.KeyAccessor.KeyBuilder<K extends Object,B extends org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B>>, org.refcodes.mixin.KeyAccessor.KeyMutator<K extends Object>, org.refcodes.mixin.KeyAccessor.KeyProperty<K extends Object>Nested classes/interfaces inherited from interface org.refcodes.mixin.PathAccessor
org.refcodes.mixin.PathAccessor.PathBuilder<B extends org.refcodes.mixin.PathAccessor.PathBuilder<?>>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathPropertyNested classes/interfaces inherited from interface org.refcodes.struct.Property
org.refcodes.struct.Property.PropertyBuilderNested classes/interfaces inherited from interface org.refcodes.struct.Relation
org.refcodes.struct.Relation.RelationBuilder<K extends Object,V extends Object>Nested classes/interfaces inherited from interface org.refcodes.mixin.ValueAccessor
org.refcodes.mixin.ValueAccessor.ValueBuilder<V extends Object,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V extends Object>, org.refcodes.mixin.ValueAccessor.ValueProperty<V extends Object> -
Method Summary
Modifier and Type Method Description default voidfromHttpCookie(String aHttpCookie)Sets the cookie according to the provided HTTP cookie text.DategetExpiresDate()Returns the expiration date of this cookie.intgetMaxAge()Returns the Max-Age (seconds) for this cookie.StringgetVersion()Returns the version this cookie.booleanisHttpOnly()Returns true if we have an HTTP only cookie.booleanisSecure()Returns true if we have a secure HTTP cookie.voidsetExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit, long aTime)Sets the expires date to the current time plus the provided time.voidsetExpiresDate(Date aExpireDate)Sets the expiration date of this cookie.voidsetHttpOnly(boolean isHttpOnly)Sets whether it be an HTTP only cookie.voidsetMaxAge(int aMaxAge)Sets the Max-Age (seconds) of this cookie.voidsetSecure(boolean isSecure)Sets whether it be a secure HTTP cookie.voidsetVersion(String aVersion)Sets the version of this cookie.default StringtoHttpCookie()Returns the cookie to be assigned to a cookie Header-Field.default ResponseCookiewithDomain(String aDomain)Sets the domain for this cookie.default ResponseCookiewithExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit, long aTime)Builder method for the methodsetExpiresAfter(TimeUnit, long).default ResponseCookiewithExpiresDate(Date aExpiresDate)Sets the expiration date of this cookie and returns this instance as of the Builder-Pattern.default ResponseCookiewithHttpCookie(String aCookie)Sets the cookie according to the provided HTTP cookie text viaCookie.fromHttpCookie(String).default ResponseCookiewithHttpOnly(boolean isHttpOnly)Sets whether it be an HTTP only cookie.default ResponseCookiewithMaxAge(int aMaxAge)Builder method forsetMaxAge(int).default ResponseCookiewithPath(String aPath)Sets the path of the cookie.default ResponseCookiewithSecure(boolean isSecure)Sets whether it be a secure HTTP cookie.default ResponseCookiewithVersion(String aVersion)Builder method forsetVersion(String).Methods inherited from interface org.refcodes.mixin.DomainAccessor
getDomainMethods inherited from interface org.refcodes.mixin.DomainAccessor.DomainMutator
setDomainMethods inherited from interface org.refcodes.mixin.DomainAccessor.DomainProperty
letDomainMethods inherited from interface org.refcodes.mixin.KeyAccessor
getKeyMethods inherited from interface org.refcodes.mixin.KeyAccessor.KeyMutator
setKeyMethods inherited from interface org.refcodes.mixin.KeyAccessor.KeyProperty
letKeyMethods inherited from interface org.refcodes.mixin.PathAccessor
getPathMethods inherited from interface org.refcodes.mixin.PathAccessor.PathMutator
setPathMethods inherited from interface org.refcodes.mixin.PathAccessor.PathProperty
letPathMethods inherited from interface org.refcodes.struct.Property
toPropertyMethods inherited from interface org.refcodes.struct.Property.PropertyBuilder
withKey, withValueMethods inherited from interface org.refcodes.mixin.ValueAccessor
getValue, getValueOrMethods inherited from interface org.refcodes.mixin.ValueAccessor.ValueMutator
setValueMethods inherited from interface org.refcodes.mixin.ValueAccessor.ValueProperty
letValue
-
Method Details
-
getMaxAge
int getMaxAge()Returns the Max-Age (seconds) for this cookie.- Returns:
- The Max-Age.
-
setMaxAge
void setMaxAge(int aMaxAge)Sets the Max-Age (seconds) of this cookie.- Parameters:
aMaxAge- Sets the Max-Age.
-
withMaxAge
Builder method forsetMaxAge(int).- Parameters:
aMaxAge- Sets the Max-Age.- Returns:
- This instance as of the Builder-Pattern.
-
getVersion
String getVersion()Returns the version this cookie.- Returns:
- The version.
-
setVersion
Sets the version of this cookie.- Parameters:
aVersion- Sets the version.
-
withVersion
Builder method forsetVersion(String).- Parameters:
aVersion- Sets the version.- Returns:
- This instance as of the Builder-Pattern.
-
setExpiresAfter
void setExpiresAfter(org.refcodes.time.TimeUnit aTimeUnit, long aTime)Sets the expires date to the current time plus the provided time. UsegetExpiresDate()to retrieve the resulting effectiveDate.- Parameters:
aTimeUnit- TheTimeUnitof the provided timeaTime- The provided time after which to expire
-
withExpiresAfter
Builder method for the methodsetExpiresAfter(TimeUnit, long).- Parameters:
aTimeUnit- TheTimeUnitof the provided timeaTime- The provided time after which to expire- Returns:
- This cookie instance for further configuration.
-
getExpiresDate
Date getExpiresDate()Returns the expiration date of this cookie.- Returns:
- The expiration date.
-
setExpiresDate
Sets the expiration date of this cookie.- Parameters:
aExpireDate- The expiration date.
-
withExpiresDate
Sets the expiration date of this cookie and returns this instance as of the Builder-Pattern.- Parameters:
aExpiresDate- the expires date- Returns:
- This instance as of the Builder-Pattern.
-
withPath
Sets the path of the cookie.- Specified by:
withPathin interfaceorg.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>
-
withDomain
Sets the domain for this cookie.- Specified by:
withDomainin interfaceorg.refcodes.mixin.DomainAccessor.DomainBuilder<ResponseCookie>
-
isHttpOnly
boolean isHttpOnly()Returns true if we have an HTTP only cookie. Such a cookie cannot be accessed client-side (via JavaScript).- Returns:
- True in case of being an HTTP only cookie.
-
setHttpOnly
void setHttpOnly(boolean isHttpOnly)Sets whether it be an HTTP only cookie. Such a cookie cannot be accessed client-side (via JavaScript).- Parameters:
isHttpOnly- True in case of being an HTTP only cookie.
-
withHttpOnly
Sets whether it be an HTTP only cookie. Such a cookie cannot be accessed client-side (via JavaScript). Returns this instance as of the builder pattern.- Parameters:
isHttpOnly- True in case of being an HTTP only cookie.- Returns:
- Returns this instance as of the Builder-Pattern.
-
isSecure
boolean isSecure()Returns true if we have a secure HTTP cookie. Such a cookie only be transferred via HTTPS.- Returns:
- True in case of being a secure only cookie.
-
setSecure
void setSecure(boolean isSecure)Sets whether it be a secure HTTP cookie. Such a cookie only be transferred via HTTPS.- Parameters:
isSecure- True in case of being a secure only cookie.
-
withSecure
Sets whether it be a secure HTTP cookie. Such a cookie only be transferred via HTTPS. Returns this instance as of the Builder-Pattern.- Parameters:
isSecure- True in case of being a secure only cookie.- Returns:
- Returns this instance as of the Builder-Pattern.
-
withHttpCookie
Sets the cookie according to the provided HTTP cookie text viaCookie.fromHttpCookie(String).- Specified by:
withHttpCookiein interfaceCookie- Parameters:
aCookie- The HTTP cookie text.- Returns:
- A
Cookieinstance as of the Builder-Pattern.
-
fromHttpCookie
Sets the cookie according to the provided HTTP cookie text.- Specified by:
fromHttpCookiein interfaceCookie- Parameters:
aHttpCookie- The HTTP cookie text.
-
toHttpCookie
Returns the cookie to be assigned to a cookie Header-Field.- Specified by:
toHttpCookiein interfaceCookie- Returns:
- The cookie value for a Header-Field.
-