Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Latest commit

 

History

History
48 lines (38 loc) · 1.84 KB

tutorial-cdi-events.asciidoc

File metadata and controls

48 lines (38 loc) · 1.84 KB
title order layout
Observable Vaadin Events
4
page

Observable Vaadin Events

The Vaadin CDI add-on publishes many Vaadin events to CDI.

It is not necessary to register a listener, using only an observer is sufficient to handle these events.

Events published to CDI include:

Warning
Whether or not ServiceDestroyEvent works with CDI during application shutdown depends on each specific implementation.

Example: Using the @Observes annotation to listen ServiceInitEvent.

public class BootstrapCustomizer {

    private void onServiceInit(@Observes
            ServiceInitEvent serviceInitEvent) {
        serviceInitEvent.addIndexHtmlRequestListener(
                this::modifyBootstrapPage);
    }

    private void modifyBootstrapPage(
            IndexHtmlResponse response) {
        response.getDocument().body().append(
                "<p>By CDI add-on</p>");
    }
}