Class ViewTemplateNames
java.lang.Object
org.apache.juneau.rest.server.view.ViewTemplateNames
Shared template-name checks applied by the view bridges before a name reaches a templating engine.
A template name is a path relative to the bridge's configured base path. Names that carry a URL scheme
(or any :) or a backslash are never valid, and raw-served names must end in one of the extensions
registered for the engine.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasAllowedExtension(String name, String... extensions) Returnstrueif the name ends with one of the allowed extensions.static booleanisPlainName(String name) Returnstrueif the name is free of URL-scheme and path-separator tricks.static voidrequirePlainName(String name) Validates a template name for the typed-view path, throwing if it is not a plain name.
-
Method Details
-
isPlainName
Returnstrueif the name is free of URL-scheme and path-separator tricks.- Parameters:
name- The template name. May benull.- Returns:
falseif the name contains:, a backslash, or a control character.
-
hasAllowedExtension
Returnstrueif the name ends with one of the allowed extensions.- Parameters:
name- The template name. Must not benull.extensions- The allowed extensions, including the leading dot (e.g.".ftlh").- Returns:
trueif the name has an allowed extension.
-
requirePlainName
Validates a template name for the typed-view path, throwing if it is not a plain name.- Parameters:
name- The template name.- Throws:
IllegalArgumentException- If the name is not plain.
-