Class ViewUtils
java.lang.Object
io.micronaut.views.ViewUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a view model for the given data.static @NonNull StringnormalizeFile(@NonNull String path, String extension) Returns a path that is converted to unix style file separators and never starts with a "/".static @NonNull StringnormalizeFolder(@Nullable String path) Returns a path with unix style folder separators that starts and ends with a "/".static @NonNull StringreadResourceAsString(@NonNull io.micronaut.core.io.ResourceLoader resourceLoader, @NonNull String name, @NonNull Charset charset) Loads a template resource as text.
-
Field Details
-
EXTENSION_SEPARATOR
-
-
Constructor Details
-
ViewUtils
public ViewUtils()
-
-
Method Details
-
modelOf
-
normalizeFolder
-
normalizeFile
Returns a path that is converted to unix style file separators and never starts with a "/". If an extension is provided and the path ends with the extension, the extension will be stripped. The extension parameter supports extensions that do and do not begin with a ".".- Parameters:
path- The path to normalizeFileextension- The file extension- Returns:
- The normalized path
-
readResourceAsString
public static @NonNull String readResourceAsString(@NonNull io.micronaut.core.io.ResourceLoader resourceLoader, @NonNull String name, @NonNull Charset charset) throws IOException Loads a template resource as text.- Parameters:
resourceLoader- The resource loadername- The template namecharset- The template character set- Returns:
- The template text
- Throws:
IOException- If the template cannot be read- Since:
- 6.2.0
-