@ExperimentalApi
public interface AssembledResources
RequiredResources.
Note, WebResourceAssembler is currently an experimental API and may break between versions of web resources.
It is advised that you use WebResourceManager in the mean time if you require a stable API.
WebResourceAssembler,
PageBuilderService| Modifier and Type | Method and Description |
|---|---|
WebResourceSet |
drainIncludedResources()
Calculates dependencies, returns requested resources, then clears the list of webresources + contexts that have
been included since the last call to
drainIncludedResources(). |
WebResourceSet |
peek()
Returns the currently requested resources as per
drainIncludedResources(), however does not clear
the internal list. |
WebResourceSet |
pollIncludedResources()
Similar to
drainIncludedResources(), but will block until there is at least one complete promise to
return. |
WebResourceSet drainIncludedResources()
drainIncludedResources().
This method ensures that no individual webresource will be emitted twice, either as part of a superbatch, context batch or individual include.
The order of resources in the returned list is as follows:
RequiredData.requireData(String, CompletionStage)
but it will return any promises that are already complete.
The WebResourceSet.isComplete() property on the returned object can be inspected to see if
(at the time pollIncludedResources() was called) there are any incomplete promises.WebResourceSet pollIncludedResources()
drainIncludedResources(), but will block until there is at least one complete promise to
return. If no promises have been added, or they are all complete, then this method returns without blocking.
The following code demonstrates the expected pattern to drain all remaining resources including waiting for promises. This pattern ensures that complete promises are output as soon as possible.
WebResourceSet resources;
do {
resources = assembler.assembled().pollIncludedResources();
resources.writeHtmlTags(out, UrlMode.AUTO);
out.flush();
} while (!resources.isComplete());
WebResourceSet peek()
drainIncludedResources(), however does not clear
the internal list. Intended to be used to debugging or introspecting the current state.
This does not block on any promises, and importantly does not return any undrained complete promises.Copyright © 2018 Atlassian. All rights reserved.