Package com.adobe.granite.ui.clientlibs
Interface HtmlLibraryManager
-
@ProviderType public interface HtmlLibraryManager
HtmlLibraryManager
provides access to repository defined html libraries.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PARAM_DEBUG_CLIENT_LIBS
request parameter name for turning on HtmlLibraryServlet debuggingstatic java.lang.String
PARAM_DEBUG_CONSOLE
request parameter name for enabling debug console (firebug + cq logging)static java.lang.String
PARAM_FORCE_THEME
request parameter name for testing a themestatic java.lang.String
REQUEST_ATTR_FORCE_CQ_URLINFO
Request attribute flag that forces the inclusion of the CQURLInfo
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
ensureCached()
Ensures that all client libraries are compiledjava.util.Map<java.lang.String,ClientLibrary>
getLibraries()
Returns all client librariesjava.util.Collection<ClientLibrary>
getLibraries(java.lang.String[] categories, LibraryType type, boolean ignoreThemed, boolean transitive)
Returns all client libraries that match the specified filters.java.util.Set<java.lang.String>
getLibrariesPaths(java.lang.String[] categories)
Returns all paths including static resources associated with the provided list of clientlib categories.HtmlLibrary
getLibrary(LibraryType type, java.lang.String path)
Returns the html library that is configured at the given path.HtmlLibrary
getLibrary(SlingHttpServletRequest request)
Returns the html library that is address by the given request.java.util.Collection<ClientLibrary>
getThemeLibraries(java.lang.String[] categories, LibraryType type, java.lang.String themeName, boolean transitive)
Returns all themed client libraries that match the type.void
invalidateOutputCache()
Invalidates the output cache.boolean
isDebugEnabled()
Checks if debug support is enabled.boolean
isGzipEnabled()
Checks if gzip compression is enabled.boolean
isMinifyEnabled()
Checks if library minification is enabled.void
writeCssInclude(SlingHttpServletRequest request, java.io.Writer out, boolean themed, java.lang.String... categories)
Writes the CSS include snippets to the given writer.void
writeCssInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories)
Writes the CSS include snippets to the given writer.void
writeIncludes(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories)
Writes the include snippets to the given writer.void
writeJsInclude(SlingHttpServletRequest request, java.io.Writer out, boolean themed, java.lang.String... categories)
Writes the JS include snippets to the given writer.void
writeJsInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories)
Writes the JS include snippets to the given writer.void
writeThemeInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories)
Writes all CSS and only themed JS include snippets to the given writer.
-
-
-
Field Detail
-
PARAM_DEBUG_CONSOLE
static final java.lang.String PARAM_DEBUG_CONSOLE
request parameter name for enabling debug console (firebug + cq logging)- See Also:
- Constant Field Values
-
PARAM_DEBUG_CLIENT_LIBS
static final java.lang.String PARAM_DEBUG_CLIENT_LIBS
request parameter name for turning on HtmlLibraryServlet debugging- See Also:
- Constant Field Values
-
PARAM_FORCE_THEME
static final java.lang.String PARAM_FORCE_THEME
request parameter name for testing a theme- See Also:
- Constant Field Values
-
REQUEST_ATTR_FORCE_CQ_URLINFO
static final java.lang.String REQUEST_ATTR_FORCE_CQ_URLINFO
Request attribute flag that forces the inclusion of the CQURLInfo- Since:
- 5.5.42
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeJsInclude
void writeJsInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories) throws java.io.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:
java.io.IOException
- if an I/O error occurs
-
writeJsInclude
void writeJsInclude(SlingHttpServletRequest request, java.io.Writer out, boolean themed, java.lang.String... categories) throws java.io.IOException
Writes the JS include snippets to the given writer. The paths to the JS libraries are included that match the given categories. Ifthemed
isfalse
, only non-themed libraries are included. Ifthemed
istrue
only 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:
java.io.IOException
- if an I/O error occurs- Since:
- 5.4
-
writeCssInclude
void writeCssInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories) throws java.io.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:
java.io.IOException
- if an I/O error occurs
-
writeCssInclude
void writeCssInclude(SlingHttpServletRequest request, java.io.Writer out, boolean themed, java.lang.String... categories) throws java.io.IOException
Writes the CSS include snippets to the given writer. The paths to the CSS libraries are included that match the given categories. Ifthemed
isfalse
, only non-themed libraries are included. Ifthemed
istrue
only 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:
java.io.IOException
- if an I/O error occurs- Since:
- 5.4
-
writeThemeInclude
void writeThemeInclude(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories) throws java.io.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:
java.io.IOException
- if an I/O error occurs
-
writeIncludes
void writeIncludes(SlingHttpServletRequest request, java.io.Writer out, java.lang.String... categories) throws java.io.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:
java.io.IOException
- if an I/O error occurs
-
getLibrary
HtmlLibrary getLibrary(LibraryType type, java.lang.String path)
Returns the html library that is configured at the given path. If no such library exists,null
is returned.- Parameters:
type
- the library typepath
- the path- Returns:
- the library or null
-
getLibrary
HtmlLibrary getLibrary(SlingHttpServletRequest request)
Returns the html library that is address by the given request. if no such library exists,null
is returned.- Parameters:
request
- the request- Returns:
- the library or null
-
isMinifyEnabled
boolean isMinifyEnabled()
Checks if library minification is enabled.- Returns:
true
if minification is enabled.
-
isDebugEnabled
boolean isDebugEnabled()
Checks if debug support is enabled.- Returns:
true
if debug is enabled.
-
isGzipEnabled
boolean isGzipEnabled()
Checks if gzip compression is enabled.- Returns:
true
if gzip is enabled.
-
getLibraries
java.util.Map<java.lang.String,ClientLibrary> getLibraries()
Returns all client libraries- Returns:
- all client libraries
- Since:
- 5.4
-
getLibraries
java.util.Collection<ClientLibrary> getLibraries(java.lang.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 ornull
to match all typesignoreThemed
-true
to filter out themed librariestransitive
-true
to resolve recursively- Returns:
- matching client libraries
- Since:
- 5.4
-
getThemeLibraries
java.util.Collection<ClientLibrary> getThemeLibraries(java.lang.String[] categories, LibraryType type, java.lang.String themeName, boolean transitive)
Returns all themed client libraries that match the type. If type isnull
all libraries are returned. If theme name is an empty string, the configured default theme is used. If theme name isnull
all themed libraries are returned.- Parameters:
categories
- the categoriestype
- type ornull
to match all typesthemeName
- theme name ornull
transitive
-true
to resolve recursively- Returns:
- matching client libraries
- Since:
- 5.4
-
getLibrariesPaths
java.util.Set<java.lang.String> getLibrariesPaths(java.lang.String[] categories)
Returns all paths including static resources associated with the provided list of clientlib categories.- Parameters:
categories
- the categories- Since:
- 6.6
-
invalidateOutputCache
void invalidateOutputCache() throws RepositoryException
Invalidates the output cache.- Throws:
RepositoryException
- if an error occurrs- Since:
- 6.4
-
ensureCached
void ensureCached() throws java.io.IOException, RepositoryException
Ensures that all client libraries are compiled- Throws:
java.io.IOException
- if an error occursRepositoryException
- if an error occurs
-
-