Package com.helger.servlet.response
Class ResponseHelperSettings
- java.lang.Object
-
- com.helger.servlet.response.ResponseHelperSettings
-
@ThreadSafe public final class ResponseHelperSettings extends Object
Contains the settings for theResponseHelperclass.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_EXPIRATION_SECONDSExpires in at least 2 days (which is the minimum to be accepted for real caching in Yahoo Guidelines).static booleanDEFAULT_RESPONSE_COMPRESSION_ENABLEDstatic booleanDEFAULT_RESPONSE_DERFLATE_ENABLEDstatic booleanDEFAULT_RESPONSE_GZIP_ENABLEDstatic LocalDateTimeEXPIRES_NEVER_DATETIMEA special date that never expiresstatic StringEXPIRES_NEVER_STRINGThe string representation of never expires date
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetExpirationSeconds()static booleanisResponseCompressionEnabled()static booleanisResponseDeflateEnabled()static booleanisResponseGzipEnabled()static com.helger.commons.state.EChangesetAll(boolean bResponseCompressionEnabled, boolean bResponseGzipEnabled, boolean bResponseDeflateEnabled)Set all parameters at once as an atomic transactionstatic com.helger.commons.state.EChangesetExpirationSeconds(int nExpirationSeconds)Set the default expiration settings to be used for objects that should use HTTP cachingstatic com.helger.commons.state.EChangesetResponseCompressionEnabled(boolean bResponseCompressionEnabled)Enable or disable the overall compression.static com.helger.commons.state.EChangesetResponseDeflateEnabled(boolean bResponseDeflateEnabled)Enable or disable Deflate compression.static com.helger.commons.state.EChangesetResponseGzipEnabled(boolean bResponseGzipEnabled)Enable or disable Gzip compression.
-
-
-
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:
trueif overall compression is enabled,falseif not
-
setResponseCompressionEnabled
@Nonnull public static com.helger.commons.state.EChange setResponseCompressionEnabled(boolean bResponseCompressionEnabled)
Enable or disable the overall compression.- Parameters:
bResponseCompressionEnabled-trueto enable it,falseto disable it- Returns:
EChange
-
isResponseGzipEnabled
public static boolean isResponseGzipEnabled()
- Returns:
trueif GZip compression is enabled,falseif not
-
setResponseGzipEnabled
@Nonnull public static com.helger.commons.state.EChange setResponseGzipEnabled(boolean bResponseGzipEnabled)
Enable or disable Gzip compression. This only has an effect ifisResponseCompressionEnabled()istrue- Parameters:
bResponseGzipEnabled-trueto enable it,falseto disable it- Returns:
EChange
-
isResponseDeflateEnabled
public static boolean isResponseDeflateEnabled()
- Returns:
trueif Deflate compression is enabled,falseif not
-
setResponseDeflateEnabled
@Nonnull public static com.helger.commons.state.EChange setResponseDeflateEnabled(boolean bResponseDeflateEnabled)
Enable or disable Deflate compression. This only has an effect ifisResponseCompressionEnabled()istrue- Parameters:
bResponseDeflateEnabled-trueto enable it,falseto 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-trueto overall enable the usagebResponseGzipEnabled-trueto enable GZip if compression is enabledbResponseDeflateEnabled-trueto 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
-
-