private void configureStyleSheet(StyleSheetsConfig config) {
styleSheetConfiguration = new StyleSheetConfiguration();
boolean supportsExternal = true;
StyleSheetExternalGenerationConfiguration externalConfig = null;
StyleSheetPageLevelGenerationConfiguration pageLevelConfig = null;
if (config != null) {
// Get the internal and external config information
externalConfig = config.getExternalCacheConfiguration();
pageLevelConfig = config.getPageLevelCacheConfiguration();
}
// Handle the external generation caching
if (externalConfig == null) {
if (logger.isDebugEnabled()) {
logger.debug(
"No " + CONFIG_EXTERNAL_STYLE_SHEET_ELEMENT +
" element in the configuration file");
}
// If the element does not exist (or has no attributes which
// is not valid according to the dtd) then we cannot support
// generation of external style sheets.
supportsExternal = false;
// Set the preferred location to be internal.
styleSheetConfiguration.setPreferredLocation(
StyleSheetConfiguration.INLINE);
} else {
// Set the base url which may not have been set.
String value = externalConfig.getBaseUrl();
if (value != null) {
MarinerURL baseURL = new MarinerURL(value);
baseURL.makeReadOnly();
styleSheetConfiguration.setBaseURL(baseURL);
}
// Set the preferred location to be external.
styleSheetConfiguration.setPreferredLocation(
StyleSheetConfiguration.EXTERNAL);
// Set the css session type.
styleSheetConfiguration.setCssSessionType(
externalConfig.getCssSessionType());
}
styleSheetConfiguration.setSupportsExternal(supportsExternal);
// Handle the page level generation caching