Vaadin Flow 24.8.0
Changes since 24.7.0
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. ifElement.getOuterHTML
is used. -
Add setContentLengthLong to VaadinResponse
Commit · Pull requestAdds the setContentLengthLong() method to VaadinResponse to be in sync with the
HttpServletResponse
.
New features
-
Upload and Download handlers
Issue · Docs for downloads · Docs for uploadsSimplifies how Flow applications handle uploads and downloads by aligning more closely with regular HTTP request handling paradigms and by improving helper APIs.
StreamResource
andReceiver
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:
-
Add ElementRequestHandler
Commit · Pull request · Issue -
Add DownloadHandler
Commit · Pull request -
Add DownloadHandler to html components
Commit · Pull request -
Add UploadHandler
Commit · Pull request -
Add factory method for UploadHandler
Commit · Pull request · Issue -
Add TransferProgressListener API
Commit · Pull request -
Create TransferUtil
Commit · Pull request · Issue -
Add overloads with TransferContext
Commit · Pull request
-
-
Reactive UI state management with Signals
Issue · Docs in draftIntroduces 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:
-
Add high-level signal APIs
Commit · Pull request -
Initialise signals environment (#21490)
Commit · Pull request -
Add trees and transactions to signals module
Commit · Pull request -
Add subscription mechanism to receive all processed events (#21402)
Commit · Pull request · Issue -
Add signal commands
Commit · Pull Request -
Add ComponentEffect helper
Pull Request
-
-
Support scanning configuration in maven plugin
Commit · Pull request · Issue · DocsAllows 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 requestMake 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
IssueUses 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 requestProvides 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 requestIntroduced
VaadinWebSecurityConfigurer
to improve modularity and readability, with almost the same logic present inVaadinWebSecurity
. This change promotes reusability and better separation of concerns while maintaining existing functionality. -
Make current user available without an AuthenticationContext instance
Commit · Pull requestMakes 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 requestSummary 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 · IssueAdds 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 · IssueBy 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 totrue
. In addition, theHotswapper.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
- Extract service worker plugin into internal package
Commit · Pull request