Package com.adobe.granite.ui.clientlibs
Interface HtmlLibraryManager
HtmlLibraryManager provides access to repository defined
html libraries.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringrequest parameter name for turning on HtmlLibraryServlet debuggingstatic final Stringrequest parameter name for enabling debug console (firebug + cq logging)static final Stringrequest parameter name for testing a themestatic final StringRequest attribute flag that forces the inclusion of the CQURLInfo -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that all client libraries are compiledReturns all client librariesgetLibraries(String[] categories, LibraryType type, boolean ignoreThemed, boolean transitive) Returns all client libraries that match the specified filters.getLibrariesPaths(String[] categories) Returns all paths including static resources associated with the provided list of clientlib categories.getLibrary(LibraryType type, String path) Returns the html library that is configured at the given path.getLibrary(SlingHttpServletRequest request) Returns the html library that is address by the given request.getThemeLibraries(String[] categories, LibraryType type, String themeName, boolean transitive) Returns all themed client libraries that match the type.voidInvalidates the output cache.booleanChecks if debug support is enabled.booleanChecks if gzip compression is enabled.booleanChecks if library minification is enabled.voidwriteCssInclude(SlingHttpServletRequest request, Writer out, boolean themed, String... categories) Writes the CSS include snippets to the given writer.voidwriteCssInclude(SlingHttpServletRequest request, Writer out, String... categories) Writes the CSS include snippets to the given writer.voidwriteIncludes(SlingHttpServletRequest request, Writer out, String... categories) Writes the include snippets to the given writer.voidwriteJsInclude(SlingHttpServletRequest request, Writer out, boolean themed, String... categories) Writes the JS include snippets to the given writer.voidwriteJsInclude(SlingHttpServletRequest request, Writer out, String... categories) Writes the JS include snippets to the given writer.voidwriteThemeInclude(SlingHttpServletRequest request, Writer out, String... categories) Writes all CSS and only themed JS include snippets to the given writer.
-
Field Details
-
PARAM_DEBUG_CONSOLE
request parameter name for enabling debug console (firebug + cq logging)- See Also:
-
PARAM_DEBUG_CLIENT_LIBS
request parameter name for turning on HtmlLibraryServlet debugging- See Also:
-
PARAM_FORCE_THEME
request parameter name for testing a theme- See Also:
-
REQUEST_ATTR_FORCE_CQ_URLINFO
Request attribute flag that forces the inclusion of the CQURLInfo- Since:
- 5.5.42
- See Also:
-
-
Method Details
-
writeJsInclude
void writeJsInclude(SlingHttpServletRequest request, Writer out, String... categories) throws IOException Writes the JS include snippets to the given writer. The paths to the JS libraries are included that match the given categories. Note that themed and non-themed libraries are included. If the request contains a "forceTheme" parameter, the themed libraries are overlaid with their respective counterparts with that given theme.- Parameters:
request- requestout- writercategories- categories- Throws:
IOException- if an I/O error occurs
-
writeJsInclude
void writeJsInclude(SlingHttpServletRequest request, Writer out, boolean themed, String... categories) throws IOException Writes the JS include snippets to the given writer. The paths to the JS libraries are included that match the given categories. Ifthemedisfalse, only non-themed libraries are included. Ifthemedistrueonly themed libraries are included and if the request contains a "forceTheme" parameter, the themed libraries are overlaid with their respective counterparts with that given theme.- Parameters:
request- requestout- writerthemed- controls if themed or non themed libraries should be includedcategories- categories- Throws:
IOException- if an I/O error occurs- Since:
- 5.4
-
writeCssInclude
void writeCssInclude(SlingHttpServletRequest request, Writer out, String... categories) throws IOException Writes the CSS include snippets to the given writer. The paths to the CSS libraries are included that match the given categories. Note that themed and non-themed libraries are included. If the request contains a "forceTheme" parameter, the themed libraries are overlaid with their respective counterparts with that given theme.- Parameters:
request- requestout- writercategories- categories- Throws:
IOException- if an I/O error occurs
-
writeCssInclude
void writeCssInclude(SlingHttpServletRequest request, Writer out, boolean themed, String... categories) throws IOException Writes the CSS include snippets to the given writer. The paths to the CSS libraries are included that match the given categories. Ifthemedisfalse, only non-themed libraries are included. Ifthemedistrueonly themed libraries are included and if the request contains a "forceTheme" parameter, the themed libraries are overlaid with their respective counterparts with that given theme.- Parameters:
request- requestout- writerthemed- controls if themed or non themed libraries should be includedcategories- categories- Throws:
IOException- if an I/O error occurs- Since:
- 5.4
-
writeThemeInclude
void writeThemeInclude(SlingHttpServletRequest request, Writer out, String... categories) throws IOException Writes all CSS and only themed JS include snippets to the given writer. The paths to the libraries are included that match the given categories. If the request contains a "forceTheme" parameter, the themed libraries are overlaid with their respective counterparts with that given theme. Please note, that the theme include should happen after the js includes since the theme js might reference themes.- Parameters:
request- requestout- writercategories- categories- Throws:
IOException- if an I/O error occurs
-
writeIncludes
void writeIncludes(SlingHttpServletRequest request, Writer out, String... categories) throws IOException Writes the include snippets to the given writer. The paths to the libraries are included that match the given categories and the theme name that is extracted from the request.
Same as:
writeCssInclude(...); writeJsInclude(...); writeThemeInclude(...);If one of the libraries to be included has assigned channels, then the inclusion is delegated to the client side library manager.- Parameters:
request- requestout- writercategories- categories- Throws:
IOException- if an I/O error occurs
-
getLibrary
Returns the html library that is configured at the given path. If no such library exists,nullis returned.- Parameters:
type- the library typepath- the path- Returns:
- the library or null
-
getLibrary
Returns the html library that is address by the given request. if no such library exists,nullis returned.- Parameters:
request- the request- Returns:
- the library or null
-
isMinifyEnabled
boolean isMinifyEnabled()Checks if library minification is enabled.- Returns:
trueif minification is enabled.
-
isDebugEnabled
boolean isDebugEnabled()Checks if debug support is enabled.- Returns:
trueif debug is enabled.
-
isGzipEnabled
boolean isGzipEnabled()Checks if gzip compression is enabled.- Returns:
trueif gzip is enabled.
-
getLibraries
Map<String,ClientLibrary> getLibraries()Returns all client libraries- Returns:
- all client libraries
- Since:
- 5.4
-
getLibraries
Collection<ClientLibrary> getLibraries(String[] categories, LibraryType type, boolean ignoreThemed, boolean transitive) Returns all client libraries that match the specified filters. If a theme name is specified, only themed libraries are returned, otherwise only non-theme libraries are returned. If theme name is an empty string, the configured default theme is used.- Parameters:
categories- the categoriestype- type ornullto match all typesignoreThemed-trueto filter out themed librariestransitive-trueto resolve recursively- Returns:
- matching client libraries
- Since:
- 5.4
-
getThemeLibraries
Collection<ClientLibrary> getThemeLibraries(String[] categories, LibraryType type, String themeName, boolean transitive) Returns all themed client libraries that match the type. If type isnullall libraries are returned. If theme name is an empty string, the configured default theme is used. If theme name isnullall themed libraries are returned.- Parameters:
categories- the categoriestype- type ornullto match all typesthemeName- theme name ornulltransitive-trueto resolve recursively- Returns:
- matching client libraries
- Since:
- 5.4
-
getLibrariesPaths
Returns all paths including static resources associated with the provided list of clientlib categories.- Parameters:
categories- the categories- Since:
- 6.6
-
invalidateOutputCache
Invalidates the output cache.- Throws:
RepositoryException- if an error occurrs- Since:
- 6.4
-
ensureCached
Ensures that all client libraries are compiled- Throws:
IOException- if an error occursRepositoryException- if an error occurs
-