Class ResponseHelperSettings


  • @ThreadSafe
    public final class ResponseHelperSettings
    extends Object
    Contains the settings for the ResponseHelper class.
    Author:
    Philip Helger
    • Field Detail

      • EXPIRES_NEVER_DATETIME

        public static final LocalDateTime EXPIRES_NEVER_DATETIME
        A special date that never expires
      • EXPIRES_NEVER_STRING

        public static final String EXPIRES_NEVER_STRING
        The string representation of never expires date
      • DEFAULT_EXPIRATION_SECONDS

        public static final int DEFAULT_EXPIRATION_SECONDS
        Expires in at least 2 days (which is the minimum to be accepted for real caching in Yahoo Guidelines).
        See Also:
        Constant Field Values
      • DEFAULT_RESPONSE_COMPRESSION_ENABLED

        public static final boolean DEFAULT_RESPONSE_COMPRESSION_ENABLED
        See Also:
        Constant Field Values
      • DEFAULT_RESPONSE_GZIP_ENABLED

        public static final boolean DEFAULT_RESPONSE_GZIP_ENABLED
        See Also:
        Constant Field Values
      • DEFAULT_RESPONSE_DERFLATE_ENABLED

        public static final boolean DEFAULT_RESPONSE_DERFLATE_ENABLED
        See Also:
        Constant Field Values
    • Method Detail

      • isResponseCompressionEnabled

        public static boolean isResponseCompressionEnabled()
        Returns:
        true if overall compression is enabled, false if not
      • setResponseCompressionEnabled

        @Nonnull
        public static com.helger.commons.state.EChange setResponseCompressionEnabled​(boolean bResponseCompressionEnabled)
        Enable or disable the overall compression.
        Parameters:
        bResponseCompressionEnabled - true to enable it, false to disable it
        Returns:
        EChange
      • isResponseGzipEnabled

        public static boolean isResponseGzipEnabled()
        Returns:
        true if GZip compression is enabled, false if not
      • setResponseGzipEnabled

        @Nonnull
        public static com.helger.commons.state.EChange setResponseGzipEnabled​(boolean bResponseGzipEnabled)
        Enable or disable Gzip compression. This only has an effect if isResponseCompressionEnabled() is true
        Parameters:
        bResponseGzipEnabled - true to enable it, false to disable it
        Returns:
        EChange
      • isResponseDeflateEnabled

        public static boolean isResponseDeflateEnabled()
        Returns:
        true if Deflate compression is enabled, false if not
      • setResponseDeflateEnabled

        @Nonnull
        public static com.helger.commons.state.EChange setResponseDeflateEnabled​(boolean bResponseDeflateEnabled)
        Enable or disable Deflate compression. This only has an effect if isResponseCompressionEnabled() is true
        Parameters:
        bResponseDeflateEnabled - true to enable it, false to disable it
        Returns:
        EChange
      • setAll

        @Nonnull
        public static com.helger.commons.state.EChange setAll​(boolean bResponseCompressionEnabled,
                                                              boolean bResponseGzipEnabled,
                                                              boolean bResponseDeflateEnabled)
        Set all parameters at once as an atomic transaction
        Parameters:
        bResponseCompressionEnabled - true to overall enable the usage
        bResponseGzipEnabled - true to enable GZip if compression is enabled
        bResponseDeflateEnabled - true to enable Deflate if compression is enabled
        Returns:
        EChange
      • getExpirationSeconds

        public static int getExpirationSeconds()
        Returns:
        The default expiration seconds for objects to be cached
      • setExpirationSeconds

        @Nonnull
        public static com.helger.commons.state.EChange setExpirationSeconds​(int nExpirationSeconds)
        Set the default expiration settings to be used for objects that should use HTTP caching
        Parameters:
        nExpirationSeconds - The number of seconds for which the response should be cached
        Returns:
        EChange