PageRenderSubscriber
Part of the Publishing SPI . A component to receive notifaction that a domain object or a standalone list of domain objects has been rendered.
API
interface PageRenderSubscriber {
void onRendering(PageType pageType) (1)
void onRenderingDomainObject(Bookmark bookmark) (2)
void onRenderingCollection(Supplier<List<Bookmark>> bookmarkSupplier) (3)
void onRenderingValue(Object value) (4)
void onRenderedDomainObject(Bookmark bookmark) (5)
void onRenderedCollection(Supplier<List<Bookmark>> bookmarkSupplier) (6)
void onRenderedValue(Object value) (7)
}
1 | onRendering(PageType)
Called just before the rendering process starts.However, if PageType#OTHER , then NO |
2 | onRenderingDomainObject(Bookmark)
Indicates that the domain object represented by the Bookmark is about to be rendered. |
3 | onRenderingCollection(Supplier)
Indicates that a standalone list of domain objects (each represented by a Bookmark is about to be rendered. |
4 | onRenderingValue(Object)
Indicates that a value is about to be rendered. |
5 | onRenderedDomainObject(Bookmark)
Indicates that the domain object represented by the Bookmark has been rendered. |
6 | onRenderedCollection(Supplier)
Indicates that a standalone list of domain objects (each represented by a Bookmark has been rendered. |
7 | onRenderedValue(Object)
Indicates that a value has been rendered. |
Members
onRendering(PageType)
Called just before the rendering process starts.However, if PageType#OTHER , then NO onRenderedXxx
method will be called.
Determines which of the onRenderedXxx
callbacks (if any) will next be called:
-
if PageType#DOMAIN_OBJECT , then will call #onRenderingDomainObject(Bookmark) next, and afterwards #onRenderedDomainObject(Bookmark) next
-
if PageType#COLLECTION , then will call #onRenderedCollection(Supplier) next
-
if PageType#VALUE , then will call #onRenderedValue(Object) next
Also, if any of the pages fail to render (eg due to an authorization exception), then - again - NO onRenderedXxx
method will be called
Implementations could use this to start a stopwatch, for example, or to reset caches.
onRenderingDomainObject(Bookmark)
Indicates that the domain object represented by the Bookmark is about to be rendered.
onRenderingCollection(Supplier)
Indicates that a standalone list of domain objects (each represented by a Bookmark is about to be rendered.
onRenderedDomainObject(Bookmark)
Indicates that the domain object represented by the Bookmark has been rendered.
onRenderedCollection(Supplier)
Indicates that a standalone list of domain objects (each represented by a Bookmark has been rendered.
Implementations
This is an SPI.
If multiple implementations of this service are registered, all will be called. |
Applib (Log4j2)
The applib provides three simple implementations for different types of objects:
-
PageRenderDomainObjectLogger (domain entities and view models)
-
PageRenderCollectionLogger (collections) and
-
PageRenderValueLogger (value types).
Each of these just logs events as they are received for their particular type of object.