Class CacheControl

    • Constructor Detail

      • CacheControl

        protected CacheControl​(boolean noCache,
                               boolean noStore,
                               boolean noTransform,
                               long maxAgeSeconds)
        Creates a new instance with the specified directives.
        Parameters:
        noCache - whether the "no-cache" directive is enabled.
        noStore - whether the "no-store" directive is enabled.
        noTransform - whether the "no-transform" directive is enabled.
        maxAgeSeconds - the value of the "max-age" directive, or -1 if disabled.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns true if all directives are disabled.
      • noCache

        public final boolean noCache()
        Returns whether the "no-cache" directive is enabled.
      • noStore

        public final boolean noStore()
        Returns whether the "no-store" directive is enabled.
      • noTransform

        public final boolean noTransform()
        Returns whether the "no-transform" directive is enabled.
      • maxAgeSeconds

        public final long maxAgeSeconds()
        Returns the value of the "max-age" directive or -1 if disabled.
      • asHeaderValue

        public abstract String asHeaderValue()
        Encodes the directives in this CacheControl into an HTTP "cache-control" header value.
        Returns:
        the "cache-control" header value, or an empty string if no directives were enabled.
      • newHeaderValueBuffer

        protected final StringBuilder newHeaderValueBuffer()
        Returns a new StringBuilder with the common directives appended. Note that the first two characters (", " must be stripped.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object