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);
|
Set<String> nameSet(Theme.Type type);
|
||||||
|
|
||||||
|
boolean isCacheEnabled();
|
||||||
|
|
||||||
void clearCache();
|
void clearCache();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class ThemeResource {
|
||||||
try {
|
try {
|
||||||
String contentType = MimeTypeUtil.getContentType(path);
|
String contentType = MimeTypeUtil.getContentType(path);
|
||||||
Theme theme = session.theme().getTheme(themeName, Theme.Type.valueOf(themType.toUpperCase()));
|
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;
|
InputStream resource;
|
||||||
if (encodingProvider != null) {
|
if (encodingProvider != null) {
|
||||||
|
|
|
@ -93,6 +93,11 @@ public class DefaultThemeManager implements ThemeManager {
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCacheEnabled() {
|
||||||
|
return factory.isCacheEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
factory.clearCache();
|
factory.clearCache();
|
||||||
|
|
|
@ -69,6 +69,10 @@ public class DefaultThemeManagerFactory {
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCacheEnabled() {
|
||||||
|
return themeCache != null;
|
||||||
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
if (themeCache != null) {
|
if (themeCache != null) {
|
||||||
themeCache.clear();
|
themeCache.clear();
|
||||||
|
|
Loading…
Reference in a new issue