/** * Write all currently included resources to the given writer. */ private <W extends Writer> W writeIncludedResources(final W writer, final UrlMode urlMode, final WebResourceFilter filter) { return writeIncludedResources(writer, urlMode, filter, Collections.<String>emptySet(), Collections.<String>emptyList()); }
/** * Returns a String of the resources tags to the previously required resources called via requireResource methods * for the specified url mode and resource filter. Note that this method will NOT clear the list of previously * required resources. * * @param urlMode the url mode to write out the resource tags * @param filter the web resource filter to filter resources on * @return a String of the resource tags * @since 2.4 */ @Override public String getRequiredResources(final UrlMode urlMode, final WebResourceFilter filter) { return writeIncludedResources(new StringWriter(), urlMode, filter).toString(); }
/** * Get the resources that have been required but excluding certain resource keys and certain contexts. * <p> * You should note that the WebResourceManager cannot break context batch resources down beyond the * granularity of the context so excluding particular resource keys does not necessary exclude them * from a context batch. To safely use this method it is expected that after the initial page load any * subsequent "dynamic" requests for resources should be at the granularity of individual resources and * not contexts. However you can request contexts if you are confident that there hasn't been an * overlap of contexts and dynamically requested macros. A typical safe example is in Confluence when * rendering macros the macro rendering process will have requested individual resources which will * not exist in any contexts. * <p> * This method is available for use by sub-classes but is not part of the public interface since it does * not form a complete solution for dynamic resource handling. * * @param urlMode the url mode to write out the resource tags * @param webResourceFilter the web resource filter to filter resources on * @param excludedResourceKeys the complete key of resources to be excluded. These exclusion will not apply to any requested contexts * so if a context happens to include these resource keys it will still be served (unless excluded as a context). * @param excludedContexts contexts to be excluded when the tags are written * @return a String of the resource tags * @since 2.12.5 */ protected String getRequiredResources(UrlMode urlMode, WebResourceFilter webResourceFilter, Set<String> excludedResourceKeys, List<String> excludedContexts) { return writeIncludedResources(new StringWriter(), urlMode, webResourceFilter, excludedResourceKeys, excludedContexts).toString(); }
/** * Writes out the resource tags to the previously required resources called via requireResource methods for the * specified url mode and resource filter. Note that this method will clear the list of previously required resources. * * @param writer the writer to write the links to * @param urlMode the url mode to write resource url links in * @param webResourceFilter the resource filter to filter resources on * @since 2.4 */ @Override public void includeResources(final Writer writer, final UrlMode urlMode, final WebResourceFilter webResourceFilter) { writeIncludedResources(writer, urlMode, webResourceFilter); clear(); }