KEYCLOAK-15498 Disable gzip encoding when themes are not cached
This commit is contained in:
parent
de8d2eafa3
commit
74b5143c5e
4 changed files with 12 additions and 1 deletions
|
@ -34,6 +34,8 @@ public interface ThemeManager {
|
|||
*/
|
||||
Set<String> nameSet(Theme.Type type);
|
||||
|
||||
boolean isCacheEnabled();
|
||||
|
||||
void clearCache();
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ThemeResource {
|
|||
try {
|
||||
String contentType = MimeTypeUtil.getContentType(path);
|
||||
Theme theme = session.theme().getTheme(themeName, Theme.Type.valueOf(themType.toUpperCase()));
|
||||
ResourceEncodingProvider encodingProvider = ResourceEncodingHelper.getResourceEncodingProvider(session, contentType);
|
||||
ResourceEncodingProvider encodingProvider = session.theme().isCacheEnabled() ? ResourceEncodingHelper.getResourceEncodingProvider(session, contentType) : null;
|
||||
|
||||
InputStream resource;
|
||||
if (encodingProvider != null) {
|
||||
|
|
|
@ -93,6 +93,11 @@ public class DefaultThemeManager implements ThemeManager {
|
|||
return themes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCacheEnabled() {
|
||||
return factory.isCacheEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() {
|
||||
factory.clearCache();
|
||||
|
|
|
@ -69,6 +69,10 @@ public class DefaultThemeManagerFactory {
|
|||
return theme;
|
||||
}
|
||||
|
||||
public boolean isCacheEnabled() {
|
||||
return themeCache != null;
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
if (themeCache != null) {
|
||||
themeCache.clear();
|
||||
|
|
Loading…
Reference in a new issue