in tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigParser.java [331:509]
public void endElement(final String uri, final String localName, final String qName) throws SAXException {
assert qName.equals(stack.peek());
final String text = buffer.toString().trim();
buffer.setLength(0);
switch (qName.hashCode()) {
case NAME:
final String parent = stack.get(stack.size() - 2);
switch (parent.hashCode()) {
case TOBAGO_CONFIG:
tobagoConfig.setName(text);
break;
case BEFORE:
tobagoConfig.addBefore(text);
break;
case AFTER:
tobagoConfig.addAfter(text);
break;
case THEME_DEFINITION:
currentTheme.setName(text);
break;
case RENDERER:
// nothing to do
break;
default:
LOG.warn("Ignoring unknown parent <" + parent + "> of tag <name>");
}
break;
case DEFAULT_THEME:
tobagoConfig.setDefaultThemeName(text);
break;
case SUPPORTED_THEME:
tobagoConfig.addSupportedThemeName(text);
break;
case THEME_COOKIE:
tobagoConfig.setThemeCookie(text);
break;
case THEME_SESSION:
tobagoConfig.setThemeSession(text);
break;
case CREATE_SESSION_SECRET:
tobagoConfig.setCreateSessionSecret(text);
break;
case CHECK_SESSION_SECRET:
tobagoConfig.setCheckSessionSecret(text);
break;
case PREVENT_FRAME_ATTACKS:
tobagoConfig.setPreventFrameAttacks(Boolean.parseBoolean(text));
break;
case SET_NOSNIFF_HEADER:
tobagoConfig.setSetNosniffHeader(Boolean.parseBoolean(text));
break;
case SECURITY_ANNOTATION:
tobagoConfig.setSecurityAnnotation(SecurityAnnotation.valueOf(text));
break;
case DIRECTIVE:
if (directiveName == null) { // before Tobago 4.0
final int i = text.indexOf(' ');
if (i < 1) {
throw new TobagoConfigurationException("CSP directive can't be parsed!");
}
tobagoConfig.getContentSecurityPolicy().addDirective(text.substring(0, i), text.substring(i + 1));
} else {
tobagoConfig.getContentSecurityPolicy().addDirective(directiveName, text);
}
directiveName = null;
break;
case DISPLAY_NAME:
currentTheme.setDisplayName(text);
break;
case FALLBACK:
currentTheme.setFallbackName(text);
break;
case THEME_DEFINITION:
currentTheme = null;
break;
case VERSION:
currentTheme.setVersion(text);
break;
case RESOURCES:
production = null;
break;
case EXCLUDES:
exclude = false;
break;
case SANITIZER_CLASS:
tobagoConfig.setSanitizerClass(text);
break;
case SANITIZER:
if (properties != null) {
tobagoConfig.setSanitizerProperties(properties);
if (properties.get("whitelist") != null) {
LOG.warn("<sanitizer><properties><entry key=\"whitelist\"> is deprecated:"
+ " use <sanitizer><properties><entry key=\"safelist\"> instead.");
}
}
properties = null;
break;
case DECODE_LINE_FEED:
tobagoConfig.setDecodeLineFeed(Boolean.parseBoolean(text));
break;
case ENABLE_TOBAGO_EXCEPTION_HANDLER:
tobagoConfig.setEnableTobagoExceptionHandler(Boolean.parseBoolean(text));
break;
case ENTRY:
properties.setProperty(entryKey, text);
entryKey = null;
break;
case EXTENSION:
extension = text;
break;
case TYPE:
type = text;
break;
case MIME_TYPE:
tobagoConfig.addMimeType(extension, type);
break;
case TOBAGO_CONFIG:
case THEME_CONFIG:
case ORDERING:
case BEFORE:
case AFTER:
case SUPPORTED_MARKUP:
case CONTENT_SECURITY_POLICY:
case THEME_DEFINITIONS:
case RENDERERS:
case RENDERER:
case SCRIPT:
case STYLE:
case PROPERTIES:
case MIME_TYPES:
case MARKUP:
case INCLUDES:
case VERSIONED:
case ATTRIBUTE:
case TAG:
case TAGS:
// nothing to do
break;
default:
LOG.warn("Ignoring unknown end tag <" + qName + ">");
}
stack.pop();
}