Skip to content

Vaadin Flow 24.8.0

Compare
Choose a tag to compare
@vaadin-bot vaadin-bot released this 18 Jun 09:50
· 19 commits to 24.8 since this release
aacd2f4

Changes since 24.7.0

All changes

Breaking changes

  • Upgrade org.jsoup:jsoup from 1.19.1 to 1.20.1
    Commit · Pull request
    The newer version rebuilds the HTML pretty-printer. The specific HTML produced by the pretty-printer may be different from previous versions and may be a breaking change, e.g. if Element.getOuterHTML is used.

  • Add setContentLengthLong to VaadinResponse
    Commit · Pull request

    Adds the setContentLengthLong() method to VaadinResponse to be in sync with the HttpServletResponse.

New features

  • Upload and Download handlers
    Issue · Docs for downloads · Docs for uploads

    Simplifies how Flow applications handle uploads and downloads by aligning more closely with regular HTTP request handling paradigms and by improving helper APIs. StreamResource and Receiver are deprecated in favour of this new API.
    Examples of usage:

    // Download a File and show a notification when completed (requires @Push)
    var anchor = new Anchor(DownloadHandler.forFile(new File("tos.pdf")
                                 .whenComplete(success -> Notification.show("Success: " + success)),
                                               "Download terms of service");
    
    // Upload a File into temporary directory on the server
    var upload = new Upload(UploadHandler.inMemory((meta, data) -> {
                          Notifiation.show("Got " + data.length + " bytes for " + meta.getFileName());
    }).onProgress((transferredBytes, totalBytes) -> 
                          Notification.show("Received "  + transferredBytes),
                             32768 // progress interval in bytes
    ));

    Related changes:

  • Reactive UI state management with Signals
    Issue · Docs in draft

    Introduces a Vaadin Flow/Java library for Signals that helps to create a UI in Vaadin Flow applications in reactive way, e.g.:

    public class SignalDemo extends VerticalLayout {
        // creates a signal instance that can be shared across the application
        private final NumberSignal counter =
                SignalFactory.IN_MEMORY_SHARED.number("counter");
    
        public SignalDemo() {
            Button button = new Button(getLabel(),
                    // updates the signal value on each button click
                    click -> counter.incrementBy(1.0));
            add(button);
    
            // Effect that updates the button text whenever the counter changes
            Signal.effect(() -> button.setText(getLabel()));
        }
    
        private String getLabel() {
            return String.format("Clicked %d times", counter.valueAsInt());
        }
    }

    For more insights about Signals concept please watch Full Stack Signals for Real-time reactive UIs. This is a preview feature in Vaadin 24.8, only covers the core framework integration - component API enhancements to be shipped in the future releases.

    Related changes:

  • Support scanning configuration in maven plugin
    Commit · Pull request · Issue · Docs

    Allows to fine tune scanning for frontend resources by defining inclusion and exclusion rules in the Flow maven plugin <configuration>:

    <frontendScanner>
        <enabled>true</enabled>
        <includeOutputDirectory>true</includeOutputDirectory>
        <!-- Only scan for company artifacts -->
        <includes>
            <include>
                <groupId>com.mycompany.*</groupId>
                <artifactId>*</artifactId>
            </include>
        </includes>
        <!--
           But ignore backed artifacts, since they do not
            contain frontend related classes
        -->
        <excludes>
           <exclude>
                <groupId>com.mycompany.backend</groupId>
                <artifactId>*</artifactId>
            </exclude>
        </excludes>
    </frontendScanner>
  • Enable preserving partial view chain
    Commit · Pull request

    Make it possible to reuse only parts of the preserve on refresh chain instead of the full chain.

  • Use Jackson in public API and implementation instead of Elemental
    Issue

    Uses Jackson library and deprecates Elemental:

    • ReactAdapter and element to support jackson
      Commit · Pull request
      Have ReactAdapter and element use Jackson. AbstractSinglePropertyField to support Jackson type.

    • WebComponent more Jackson
      Commit · Pull request
      Change more parts of webComponent to use Jackson instead of elemental.

    • Use single scanner for plugin class scan
      Commit · Pull request · Issue

    • Router parts to jackson
      Commit · Pull request
      Use jackson for router and navigation.

    • Internals to jackson
      Commit · Pull request
      Change internal functions to use jackson.

    • Jackson used in dev-server
      Commit · Pull request
      Use jackson instead of elemental in the dev-server.

    • Add ignore version check to plugin params
      Commit · Pull request · Issue

    • Use jackson for setting up configuration
      Commit · Pull request
      Use jackson for setting up configuration settings.

    • Change internal json handling to jackson
      Commit · Pull request
      Change internal json manipulation from elemental to jackson.

    • Plugins to use jackson
      Commit · Pull request
      Update plugins to use jackson for json handling.

  • Add support for Gradle configuration cache
    Commit · Pull request · Issue

  • Make an Executor available through VaadinService
    Commit · Pull request

    Provides access to an Executor instance from VaadinService to submit asynchronous tasks. The default single-threaded executor can be replaced by a custom instance by registering it with a VaadinServiceInitListener. The spring add-on tries to detect an existing TaskExecutor bean, otherwise it falls back to the default executor. To provide a specific TaskExecutor bean, different from the application default, the bean definition can be named VaadinTaskExecutor or be annotated with @VaadinTaskExecutor.

  • Introduce VaadinSecurityConfigurer for modular security configuration
    Commit · Pull request

    Introduced VaadinWebSecurityConfigurer to improve modularity and readability, with almost the same logic present in VaadinWebSecurity. This change promotes reusability and better separation of concerns while maintaining existing functionality.

  • Make current user available without an AuthenticationContext instance
    Commit · Pull request

    Makes it possible to write an application method like public static Optional<User> getCurrentUser() { return AuthenticationContext.getCurrentAuthenticatedUser(AppUserInfo.class).map(AppUserInfo::user); } instead of re-implementing everything from AuthenticationContext

  • Add a shortcut to get DeploymentConfiguration from UIInternals
    Commit · Pull request

    Summary of Change: Added a helper method in UIInternals to get deployment configurations from the service from the session. Motivation and Context: There are many areas of code that need to access deployment configuration from UIInternals but accessing is quite clunky and long.

  • Support hoisted Vite install in production & bundle builds
    Commit · Pull request

  • Scan Maven "provided" scoped dependencies
    Commit · Pull request · Issue

    Adds the "provided" scope to the list of Maven dependency scopes considered during class scanning by the Flow maven plugin.

  • Allow forcing Hotswapper to reload the page
    Commit · Pull request · Issue

    By default, on class change, Hotswapper determines the best strategy to refresh the browser page. However, in some situations, a full page reload may be a better option. This change allows forcing Hotswapper to always trigger a full page reload if the vaadin.hotswap.forcePageReload system property is set to true. In addition, the Hotswapper.forcePageReload() method can be called to change the behavior at runtime instead of setting the system property.

  • Auto-reload service worker in dev mode
    Commit · Pull request
    Do not generate a 1 item list for the default empty string in dev mode init for file extensions.

  • Update plugin id in order to publish flow-gradle-plugin separately
    Commit · Pull request

Code refactoring