Interface ResponseCookie

  • 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<java.lang.String>, org.refcodes.mixin.KeyAccessor.KeyBuilder<java.lang.String,org.refcodes.structure.Relation.RelationBuilder<java.lang.String,java.lang.String>>, org.refcodes.mixin.KeyAccessor.KeyMutator<java.lang.String>, org.refcodes.mixin.KeyAccessor.KeyProperty<java.lang.String>, org.refcodes.mixin.PathAccessor, org.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>, org.refcodes.mixin.PathAccessor.PathMutator, org.refcodes.mixin.PathAccessor.PathProperty, org.refcodes.structure.Property, org.refcodes.structure.Property.PropertyBuilder, org.refcodes.structure.Relation<java.lang.String,java.lang.String>, org.refcodes.structure.Relation.RelationBuilder<java.lang.String,java.lang.String>, org.refcodes.mixin.ValueAccessor<java.lang.String>, org.refcodes.mixin.ValueAccessor.ValueBuilder<java.lang.String,org.refcodes.structure.Relation.RelationBuilder<java.lang.String,java.lang.String>>, org.refcodes.mixin.ValueAccessor.ValueMutator<java.lang.String>, org.refcodes.mixin.ValueAccessor.ValueProperty<java.lang.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.DomainProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.KeyAccessor

        org.refcodes.mixin.KeyAccessor.KeyBuilder<K extends java.lang.Object,B extends org.refcodes.mixin.KeyAccessor.KeyBuilder<K,B>>, org.refcodes.mixin.KeyAccessor.KeyMutator<K extends java.lang.Object>, org.refcodes.mixin.KeyAccessor.KeyProperty<K extends java.lang.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.PathProperty
      • Nested classes/interfaces inherited from interface org.refcodes.structure.Property

        org.refcodes.structure.Property.PropertyBuilder
      • Nested classes/interfaces inherited from interface org.refcodes.structure.Relation

        org.refcodes.structure.Relation.RelationBuilder<K extends java.lang.Object,V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.ValueAccessor

        org.refcodes.mixin.ValueAccessor.ValueBuilder<V extends java.lang.Object,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V extends java.lang.Object>, org.refcodes.mixin.ValueAccessor.ValueProperty<V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void fromHttpCookie​(java.lang.String aHttpCookie)
      Sets the cookie according to the provided HTTP cookie text.
      java.util.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​(java.util.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 java.lang.String toHttpCookie()
      Returns the cookie to be assigned to a cookie Header-Field.
      default ResponseCookie withDomain​(java.lang.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​(java.util.Date aExpiresDate)
      Sets the expiration date of this cookie and returns this instance as of the Builder-Pattern.
      default ResponseCookie withHttpCookie​(java.lang.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​(java.lang.String aPath)
      Sets the path of the cookie.
      default ResponseCookie withSecure​(boolean isSecure)
      Sets whether it be a secure HTTP cookie.
      • Methods inherited from interface org.refcodes.mixin.DomainAccessor

        getDomain
      • Methods inherited from interface org.refcodes.mixin.DomainAccessor.DomainMutator

        setDomain
      • Methods inherited from interface org.refcodes.mixin.KeyAccessor

        getKey
      • Methods inherited from interface org.refcodes.mixin.KeyAccessor.KeyMutator

        setKey
      • Methods inherited from interface org.refcodes.mixin.PathAccessor

        getPath
      • Methods inherited from interface org.refcodes.mixin.PathAccessor.PathMutator

        setPath
      • Methods inherited from interface org.refcodes.structure.Property

        toProperty
      • Methods inherited from interface org.refcodes.structure.Property.PropertyBuilder

        withKey, withValue
      • Methods inherited from interface org.refcodes.mixin.ValueAccessor

        getValue
      • Methods inherited from interface org.refcodes.mixin.ValueAccessor.ValueMutator

        setValue
    • Method Detail

      • setExpiresAfter

        void setExpiresAfter​(org.refcodes.time.TimeUnit aTimeUnit,
                             long aTime)
        Sets the expires date to the current time plus the provided time. Use getExpiresDate() to retrieve the resulting effective Date.
        Parameters:
        aTimeUnit - The TimeUnit of the provided time
        aTime - The provided time after which to expire
      • withExpiresAfter

        default ResponseCookie withExpiresAfter​(org.refcodes.time.TimeUnit aTimeUnit,
                                                long aTime)
        Builder method for the method setExpiresAfter(TimeUnit, long).
        Parameters:
        aTimeUnit - The TimeUnit of the provided time
        aTime - The provided time after which to expire
        Returns:
        This ResponseCookie instance for further configuration.
      • getExpiresDate

        java.util.Date getExpiresDate()
        Returns the expiration date of this ResponseCookie.
        Returns:
        The expiration date.
      • setExpiresDate

        void setExpiresDate​(java.util.Date aExpireDate)
        Sets the expiration date of this cookie.
        Parameters:
        aExpireDate - The expiration date.
      • withExpiresDate

        default ResponseCookie withExpiresDate​(java.util.Date aExpiresDate)
        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

        default ResponseCookie withPath​(java.lang.String aPath)
        Sets the path of the cookie.
        Specified by:
        withPath in interface org.refcodes.mixin.PathAccessor.PathBuilder<ResponseCookie>
      • withDomain

        default ResponseCookie withDomain​(java.lang.String aDomain)
        Sets the domain for this cookie.
        Specified by:
        withDomain in interface org.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

        default ResponseCookie withHttpOnly​(boolean isHttpOnly)
        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

        default ResponseCookie withSecure​(boolean isSecure)
        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.
      • fromHttpCookie

        default void fromHttpCookie​(java.lang.String aHttpCookie)
        Sets the cookie according to the provided HTTP cookie text.
        Specified by:
        fromHttpCookie in interface Cookie
        Parameters:
        aHttpCookie - The HTTP cookie text.
      • toHttpCookie

        default java.lang.String toHttpCookie()
        Returns the cookie to be assigned to a cookie Header-Field.
        Specified by:
        toHttpCookie in interface Cookie
        Returns:
        The cookie value for a Header-Field.